Hi List, 
I think I should have eaten much more Fortune Cookies this past Weekend, I have been getting way too many JSF probs today. 

For starters, is this a MyFaces bug? (concerns session.invalidate() )

-- On the page I have: 
<h:commandLink  action="#{portalbean.logout}" title="Logout">
<h:graphicImage url="../pics/login/btn_logo.gif" style="border:none;">
</h:graphicImage>
</h:commandLink>
-- In the backing bean, I have:  

public String logout() {
        FacesContext context = FacesContext.getCurrentInstance();
    HttpSession session = (HttpSession) context.getExternalContext().getSession(false);
    session.invalidate();
    logger.error("Session has been cleared with necessary data ");
    return "logout";
}

--  & In faces-config to close the circle:
  <navigation-rule>
      <from-view-id>/WEB-INF/resources/pages/portal.jsp</from-view-id>

      

      <navigation-case>
         <from-outcome>logout</from-outcome>
         <to-view-id>/WEB-INF/resources/pages/loginPage.jsp</to-view-id>
         <redirect/>
      </navigation-case>
... 

I had expected this would bring the user back to the login page, yet what I get is this Exception:

2006-02-20 19:06:18,557 ERROR [org.apache.catalina.core.ContainerBase.[Catalina].[localhost].[/Mnemonica].[Faces Servlet]] - Servlet.service() for servlet Faces Servlet threw exception
java.lang.IllegalStateException: Cannot create a session after the response has been committed
at org.apache.catalina.connector.Request.doGetSession(Request.java:2206)
at org.apache.catalina.connector.Request.getSession(Request.java:2024)
at org.apache.catalina.connector.RequestFacade.getSession(RequestFacade.java:831)
at org.apache.catalina.connector.RequestFacade.getSession(RequestFacade.java:842)
at org.apache.myfaces.component.html.util.ExtensionsFilter.getFacesContext(ExtensionsFilter.java:185)
at org.apache.myfaces.component.html.util.ExtensionsFilter.doFilter(ExtensionsFilter.java:142)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:202)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:213)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:178)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:126)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:105)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:107)
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:148)
at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:868)
at org.apache.coyote.http11.Http11BaseProtocol$Http11ConnectionHandler.processConnection(Http11BaseProtocol.java:663)
at org.apache.tomcat.util.net.PoolTcpEndpoint.processSocket(PoolTcpEndpoint.java:527)
at org.apache.tomcat.util.net.LeaderFollowerWorkerThread.runIt(LeaderFollowerWorkerThread.java:80)
at org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:684)
at java.lang.Thread.run(Thread.java:613)


--------------------

I'll post the other 2 probs later. (I'll first finish the remaining cookies - perhaps it magically works when I come back at my desk then :-)
Bye & thx for suggestions,
Philippe


Reply via email to