1 Reply Latest reply on May 31, 2010 2:55 AM by Alexander Nemsadze

    Logout problem on JBoss AS 5.1

    Jervis Liu Apprentice
      Hi, my application is Seam 2.1.0 GA based, everything works fine on JBoss AS 4.3. However, log out does not work anymore when I move to JBoss AS 5.1. A "java.lang.IllegalStateException: Cannot create a session after the response has been committed" exception is thrown after logout. See below:

      22:13:20,280 ERROR Servlet.service() for servlet guvnorService
      threw exception
      org.jboss.seam.InstantiationException: Could not instantiate Seam component: org
      .jboss.seam.web.session
              at org.jboss.seam.Component.newInstance(Component.java:2066)
              at org.jboss.seam.Component.getInstance(Component.java:1948)
              at org.jboss.seam.Component.getInstance(Component.java:1927)
              at org.jboss.seam.Component.getInstance(Component.java:1921)
              at org.jboss.seam.Component.getInstance(Component.java:1894)
              at org.jboss.seam.web.Session.getInstance(Session.java:122)
              at org.jboss.seam.contexts.Contexts.flushAndDestroyContexts(Contexts.jav
      a:375)
              at org.jboss.seam.contexts.Lifecycle.endRequest(Lifecycle.java:136)
              at org.jboss.seam.servlet.ContextualHttpServletRequest.run(ContextualHtt
      pServletRequest.java:72)
              at org.jboss.seam.web.ContextFilter.doFilter(ContextFilter.java:37)
              at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(Appl
      icationFilterChain.java:235)
              at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationF
      ilterChain.java:206)
              at org.jboss.web.tomcat.filters.ReplyHeaderFilter.doFilter(ReplyHeaderFi
      lter.java:96)
              at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(Appl
      icationFilterChain.java:235)
              at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationF
      ilterChain.java:206)
              at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperV
      alve.java:235)
              at org.apache.catalina.core.StandardContextValve.invoke(StandardContextV
      alve.java:191)
              at org.jboss.web.tomcat.security.SecurityAssociationValve.invoke(Securit
      yAssociationValve.java:190)
              at org.jboss.web.tomcat.security.JaccContextValve.invoke(JaccContextValv
      e.java:92)
              at org.jboss.web.tomcat.security.SecurityContextEstablishmentValve.proce
      ss(SecurityContextEstablishmentValve.java:126)
              at org.jboss.web.tomcat.security.SecurityContextEstablishmentValve.invok
      e(SecurityContextEstablishmentValve.java:70)
              at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.j
      ava:127)
              at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.j
      ava:102)
              at org.jboss.web.tomcat.service.jca.CachedConnectionValve.invoke(CachedC
      onnectionValve.java:158)
              at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineVal
      ve.java:109)
              at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.jav
      a:330)
              at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java
      :829)
              at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.proce
      ss(Http11Protocol.java:598)
              at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:44
      7)
              at java.lang.Thread.run(Unknown Source)
      Caused by: java.lang.IllegalStateException: Cannot create a session after the re
      sponse has been committed
              at org.apache.catalina.connector.Request.doGetSession(Request.java:2338)

              at org.apache.catalina.connector.Request.getSession(Request.java:2094)
              at org.apache.catalina.connector.RequestFacade.getSession(RequestFacade.
      java:833)
              at org.jboss.seam.servlet.ServletRequestSessionMap.put(ServletRequestSes
      sionMap.java:87)
              at org.jboss.seam.servlet.ServletRequestSessionMap.put(ServletRequestSes
      sionMap.java:25)
              at org.jboss.seam.contexts.BasicContext.set(BasicContext.java:85)
              at org.jboss.seam.Component.newInstance(Component.java:2048)
              ... 29 more

      My logout.jsp is as below:

      <%
              org.jboss.seam.Seam.invalidateSession();
          String redirectURL = "Guvnor.html";
          response.sendRedirect(redirectURL);
      %>

      I also tried

      <%
              org.jboss.seam.security.Identity.instance().logout();
          String redirectURL = "Guvnor.html";
          response.sendRedirect(redirectURL);
      %>

      Still same exception.  The sendRedirect is not the cause as well, as I removed sendRedirect, same problem exists.

      I also upgraded to Seam 2.1.2GA and 2.2.0GA, does not help. Same problem.

      Can someone shed some light please on what may cause this problem? Is this a Seam problem or I did sth wrong in my application?