No session object available in portal theme? - Websphere

This is a discussion on No session object available in portal theme? - Websphere ; We have a situation where we are modifying our portal theme to check for a session attribute and then do a conditional redirect. The code has to go in the head.jspf in order to work as intended. However, if I ...

+ Reply to Thread
Results 1 to 7 of 7

Thread: No session object available in portal theme?

  1. No session object available in portal theme?

    We have a situation where we are modifying our portal theme to check for a session attribute and then do a conditional redirect. The code has to go in the head.jspf in order to work as intended. However, if I use a jstl tag like:



    ${sessionScope.myAttribute == true}



    I get a stack trace dumped into SystemOut with the root line:

    Exception thrown : java.lang.IllegalStateException: jsp.error.page.noSession

    at org.apache.jasper.runtime.PageContextImpl.getAttri bute(PageContextImpl.java:271)


    I have set the property "public.session = true" in the Navigation.properties file, but that made no difference.



    Does anyone have any suggestion or guidance about how to check a session variable in Portal 6 theme files?

    We were doing this in Portal 5.1 and the code is pretty much cut and paste, but it doesn't work in Portal 6.



    Any help would be greatly appreciated.

  2. Re: No session object available in portal theme?

    I think theme is getting loaded when the server starts before any session is created. But you are trying to access the session before it is created.



    Include some condition to check wheather it is accessed for first time or not.



    Regards

  3. Re: No session object available in portal theme?

    There should be a session because the code that is checking the session attribute is only run if the user is logged in, and I have written a custom login piece that adds a session attribute on the post login method that is called by IBM's login code.



    I see no reason at all why there is no HttpSession object present in code that is only run after a user logs in.

  4. Re: No session object available in portal theme?

    there should be a session available in the theme, it is part of the wps enterprise app



    what exact error are you getting?

    Jim





    IBM Certified System Administrator -- WebSphere Portal V6.0, V5.1, V5.0

    IBM Certified Solution Developer -- WebSphere Portal V5.1, v6.0



    The postings on this site are my own and do not necessarily represent the positions, strategies, or opinions of IBM

  5. Re: No session object available in portal theme?

    This happens when you try to use the jstl tag ${sessionScope.myAttribute} in the Default.jspf file.



    The page renders blank because the jsp doesn't get compiled, and if you look in the log you get the following stack trace:



    5/2/08 9:30:38:819 CDT 00000058 ServletWrappe E SRVE0068E: Could not invoke the service() method on servlet /themes/html/MyCompany/Default.jsp. Exception thrown : java.lang.IllegalStateException: jsp.error.page.noSession

    at org.apache.jasper.runtime.PageContextImpl.getAttri bute(PageContextImpl.java:271)

    at org.apache.commons.el.ImplicitObjects$3.getValue(I mplicitObjects.java:363)

    at org.apache.commons.el.EnumeratedMap.get(Enumerated Map.java:115)

    at org.apache.commons.el.ArraySuffix.evaluate(ArraySu ffix.java:218)

    at org.apache.commons.el.ComplexValue.evaluate(Comple xValue.java:145)

    at org.apache.commons.el.BinaryOperatorExpression.eva luate(BinaryOperatorExpression.java:154)

    at org.apache.commons.el.ExpressionEvaluatorImpl.eval uate(ExpressionEvaluatorImpl.java:263)

    at org.apache.commons.el.ExpressionEvaluatorImpl.eval uate(ExpressionEvaluatorImpl.java:190)

    at org.apache.jasper.runtime.PageContextImpl.propriet aryEvaluate(PageContextImpl.java:730)

    at com.ibm._jsp._Default._jspService(_Default.java:96 8)

    at com.ibm.ws.jsp.runtime.HttpJspBase.service(HttpJsp Base.java:93)

    at javax.servlet.http.HttpServlet.service(HttpServlet .java:856)

    at com.ibm.ws.webcontainer.servlet.ServletWrapper.ser vice(ServletWrapper.java:1585)

    at com.ibm.ws.webcontainer.servlet.ServletWrapper.ser vice(ServletWrapper.java:1534)

    at com.ibm.ws.webcontainer.filter.WebAppFilterChain.d oFilter(WebAppFilterChain.java:113)

    at com.ibm.ws.webcontainer.filter.WebAppFilterChain._ doFilter(WebAppFilterChain.java:82)

    at com.ibm.ws.webcontainer.servlet.ServletWrapper.han dleRequest(ServletWrapper.java:772)

    at com.ibm.wsspi.webcontainer.servlet.GenericServletW rapper.handleRequest(GenericServletWrapper.java:12 1)

    at com.ibm.ws.jsp.webcontainerext.JSPExtensionServlet Wrapper.handleRequest(JSPExtensionServletWrapper.j ava:215)

    at com.ibm.ws.webcontainer.webapp.WebAppRequestDispat cher.include(WebAppRequestDispatcher.java:670)

    at com.ibm.wps.services.dispatcher.DispatcherServiceI mpl.handleRequest(DispatcherServiceImpl.java:87)

    at com.ibm.wps.services.dispatcher.DispatcherServiceI mpl.include(DispatcherServiceImpl.java:52)

    at com.ibm.wps.services.dispatcher.Dispatcher.include (Dispatcher.java:45)

    at com.ibm.wps.engine.templates.themes.Default.doDisp atch(Default.java:190)

    at com.ibm.wps.engine.templates.themes.Default.render (Default.java:152)

    at com.ibm.wps.engine.templates.ThemeTemplate.render( ThemeTemplate.java:67)

    at com.ibm.wps.engine.phases.WPRenderPhase.processRen dering(WPRenderPhase.java:225)

    at com.ibm.wps.engine.phases.WPBaseRenderPhase.execut e(WPBaseRenderPhase.java:166)

    at com.ibm.wps.state.phases.AbstractRenderPhase.next( AbstractRenderPhase.java:106)

    at com.ibm.wps.engine.phases.WPAbstractRenderPhase.ne xt(WPAbstractRenderPhase.java:94)

    at com.ibm.wps.engine.Servlet.callPortal(Servlet.java :772)

    at com.ibm.wps.engine.Servlet.doGet(Servlet.java:610)

    ..

    ..

    ..

    (tons more that isn't relevant)



    If I try to use a regular jsp statement like

    then I get a null pointer exception in the SystemOut.log, so I know that the session object isn't there for some reason.

  6. Re: No session object available in portal theme?

    do you still have this at the top of your default.jsp?





    if so try changing it to true

    Jim




    IBM Certified System Administrator -- WebSphere Portal V6.0, V5.1, V5.0

    IBM Certified Solution Developer -- WebSphere Portal V5.1, v6.0



    The postings on this site are my own and do not necessarily represent the positions, strategies, or opinions of IBM

  7. Re: No session object available in portal theme?

    Changing to in the Default.jspf does fix the compilation error. Thanks.

+ Reply to Thread