Uploaded image for project: 'Seam 2'
  1. Seam 2
  2. JBSEAM-4742

SEAM&JETTY: java.lang.IllegalStateException: No SessionHandler or SessionManager

    Details

      Description

      Hello all.
      I am using SEAM with JBoss/Jetty. And I get error associated with incorrect work SEAM with Request.getSession() method.

      In Jetty, HttpConnection.java (http://www.java2s.com/Open-Source/Java-Document/Sevlet-Container/jetty-modules/org/mortbay/jetty/HttpConnection.java.htm) handle request.
      And Request class (http://www.java2s.com/Open-Source/Java-Document/Sevlet-Container/jetty-modules/org/mortbay/jetty/Request.java.htm) include link to SessionManager.

      After request processed, Jetty recycle (in finally block) request, and set sessionManager == null:
      ------------

      In my app exist login page. I type login&password and get next error:

      HTTP ERROR 500
      Problem accessing /myapp/login.seam. Reason:
      Could not instantiate Seam component: org.jboss.seam.security.identity
      Caused by:
      org.jboss.seam.InstantiationException: Could not instantiate Seam component: org.jboss.seam.security.identity
      at org.jboss.seam.Component.newInstance(Component.java:1986)
      at org.jboss.seam.contexts.Contexts.startup(Contexts.java:304)
      at org.jboss.seam.contexts.Contexts.startup(Contexts.java:278)
      at org.jboss.seam.contexts.Lifecycle.beginSession(Lifecycle.java:191)
      at org.jboss.seam.contexts.ServletLifecycle.beginSession(ServletLifecycle.java:124)
      at org.jboss.seam.servlet.SeamListener.sessionCreated(SeamListener.java:44)
      at org.mortbay.jetty.servlet.AbstractSessionManager.addSession(AbstractSessionManager.java:575)
      at org.mortbay.jetty.servlet.AbstractSessionManager.newHttpSession(AbstractSessionManager.java:413)
      at org.mortbay.jetty.Request.getSession(Request.java:1243)
      at org.jboss.seam.mock.MockExternalContext.getSessionMap(MockExternalContext.java:349)
      at org.jboss.seam.contexts.FacesLifecycle.beginExceptionRecovery(FacesLifecycle.java:69)
      at org.jboss.seam.web.ExceptionFilter.endWebRequestAfterException(ExceptionFilter.java:96)
      at org.jboss.seam.web.ExceptionFilter.doFilter(ExceptionFilter.java:70)
      at org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:69)
      at org.jboss.seam.web.RedirectFilter.doFilter(RedirectFilter.java:45)
      at org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:69)
      at org.jboss.seam.servlet.SeamFilter.doFilter(SeamFilter.java:158)
      at org.mortbay.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1212)
      at org.mortbay.jetty.servlet.ServletHandler.handle(ServletHandler.java:399)
      at org.mortbay.jetty.security.SecurityHandler.handle(SecurityHandler.java:216)
      at org.mortbay.jetty.servlet.SessionHandler.handle(SessionHandler.java:182)
      at org.mortbay.jetty.handler.ContextHandler.handle(ContextHandler.java:766)
      at org.mortbay.jetty.webapp.WebAppContext.handle(WebAppContext.java:450)
      at org.mortbay.jetty.handler.ContextHandlerCollection.handle(ContextHandlerCollection.java:230)
      at org.mortbay.jetty.handler.HandlerCollection.handle(HandlerCollection.java:114)
      at org.mortbay.jetty.handler.HandlerWrapper.handle(HandlerWrapper.java:152)
      at org.mortbay.jetty.handler.StatisticsHandler.handle(StatisticsHandler.java:53)
      at org.mortbay.jetty.handler.HandlerWrapper.handle(HandlerWrapper.java:152)
      at org.mortbay.jetty.Server.handle(Server.java:323)
      at org.mortbay.jetty.HttpConnection.handleRequest(HttpConnection.java:542)
      at org.mortbay.jetty.HttpConnection$RequestHandler.content(HttpConnection.java:945)
      at org.mortbay.jetty.HttpParser.parseNext(HttpParser.java:756)
      at org.mortbay.jetty.HttpParser.parseAvailable(HttpParser.java:218)
      at org.mortbay.jetty.HttpConnection.handle(HttpConnection.java:404)
      at org.mortbay.io.nio.SelectChannelEndPoint.run(SelectChannelEndPoint.java:410)
      at org.mortbay.thread.QueuedThreadPool$PoolThread.run(QueuedThreadPool.java:582)
      Caused by: java.lang.IllegalStateException: No SessionHandler or SessionManager
      at org.mortbay.jetty.Request.getSession(Request.java:1225)
      at com.sun.faces.context.SessionMap.getSession(ExternalContextImpl.java:1002)
      at com.sun.faces.context.SessionMap.get(ExternalContextImpl.java:962)
      at org.jboss.seam.contexts.ServerConversationContext.get(ServerConversationContext.java:102)
      at org.jboss.seam.contexts.Contexts.lookupInStatefulContexts(Contexts.java:189)
      at org.jboss.seam.Component.getInstance(Component.java:1842)
      at org.jboss.seam.core.Events.raiseEvent(Events.java:76)
      at org.jboss.seam.Component.newInstance(Component.java:1979)
      at org.jboss.seam.contexts.Contexts.startup(Contexts.java:304)
      at org.jboss.seam.contexts.Contexts.startup(Contexts.java:278)
      at org.jboss.seam.contexts.Lifecycle.beginSession(Lifecycle.java:191)
      at org.jboss.seam.contexts.ServletLifecycle.beginSession(ServletLifecycle.java:125)
      at org.jboss.seam.servlet.SeamListener.sessionCreated(SeamListener.java:45)
      at org.mortbay.jetty.servlet.AbstractSessionManager.addSession(AbstractSessionManager.java:575)
      at org.mortbay.jetty.servlet.AbstractSessionManager.newHttpSession(AbstractSessionManager.java:413)
      at org.mortbay.jetty.Request.getSession(Request.java:1243)
      at org.jboss.seam.mock.MockExternalContext.getSessionMap(MockExternalContext.java:349)
      at org.jboss.seam.contexts.FacesLifecycle.beginExceptionRecovery(FacesLifecycle.java:69)
      at org.jboss.seam.web.ExceptionFilter.endWebRequestAfterException(ExceptionFilter.java:96)
      at org.jboss.seam.web.ExceptionFilter.doFilter(ExceptionFilter.java:70)
      at org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:69)
      at org.jboss.seam.web.RedirectFilter.doFilter(RedirectFilter.java:46)
      at org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:69)
      at org.jboss.seam.servlet.SeamFilter.doFilter(SeamFilter.java:159)
      at org.mortbay.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1213)
      ... 18 more
      Caused by:
      java.lang.IllegalStateException: No SessionHandler or SessionManager
      at org.mortbay.jetty.Request.getSession(Request.java:1225)
      at com.sun.faces.context.SessionMap.getSession(ExternalContextImpl.java:1002)
      at com.sun.faces.context.SessionMap.get(ExternalContextImpl.java:962)
      at org.jboss.seam.contexts.ServerConversationContext.get(ServerConversationContext.java:102)
      at org.jboss.seam.contexts.Contexts.lookupInStatefulContexts(Contexts.java:189)
      at org.jboss.seam.Component.getInstance(Component.java:1842)
      at org.jboss.seam.core.Events.raiseEvent(Events.java:76)
      at org.jboss.seam.Component.newInstance(Component.java:1979)
      at org.jboss.seam.contexts.Contexts.startup(Contexts.java:304)
      at org.jboss.seam.contexts.Contexts.startup(Contexts.java:278)
      at org.jboss.seam.contexts.Lifecycle.beginSession(Lifecycle.java:191)
      at org.jboss.seam.contexts.ServletLifecycle.beginSession(ServletLifecycle.java:125)
      at org.jboss.seam.servlet.SeamListener.sessionCreated(SeamListener.java:45)
      at org.mortbay.jetty.servlet.AbstractSessionManager.addSession(AbstractSessionManager.java:575)
      at org.mortbay.jetty.servlet.AbstractSessionManager.newHttpSession(AbstractSessionManager.java:413)
      at org.mortbay.jetty.Request.getSession(Request.java:1243)
      at org.jboss.seam.mock.MockExternalContext.getSessionMap(MockExternalContext.java:349)
      at org.jboss.seam.contexts.FacesLifecycle.beginExceptionRecovery(FacesLifecycle.java:69)
      at org.jboss.seam.web.ExceptionFilter.endWebRequestAfterException(ExceptionFilter.java:96)
      at org.jboss.seam.web.ExceptionFilter.doFilter(ExceptionFilter.java:70)
      at org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:69)
      at org.jboss.seam.web.RedirectFilter.doFilter(RedirectFilter.java:46)
      at org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:69)
      at org.jboss.seam.servlet.SeamFilter.doFilter(SeamFilter.java:159)
      at org.mortbay.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1213)
      at org.mortbay.jetty.servlet.ServletHandler.handle(ServletHandler.java:399)
      at org.mortbay.jetty.security.SecurityHandler.handle(SecurityHandler.java:216)
      at org.mortbay.jetty.servlet.SessionHandler.handle(SessionHandler.java:182)
      at org.mortbay.jetty.handler.ContextHandler.handle(ContextHandler.java:766)
      at org.mortbay.jetty.webapp.WebAppContext.handle(WebAppContext.java:450)
      at org.mortbay.jetty.handler.ContextHandlerCollection.handle(ContextHandlerCollection.java:230)
      at org.mortbay.jetty.handler.HandlerCollection.handle(HandlerCollection.java:114)
      at org.mortbay.jetty.handler.HandlerWrapper.handle(HandlerWrapper.java:152)
      at org.mortbay.jetty.handler.StatisticsHandler.handle(StatisticsHandler.java:53)
      at org.mortbay.jetty.handler.HandlerWrapper.handle(HandlerWrapper.java:152)
      at org.mortbay.jetty.Server.handle(Server.java:323)
      at org.mortbay.jetty.HttpConnection.handleRequest(HttpConnection.java:542)
      at org.mortbay.jetty.HttpConnection$RequestHandler.content(HttpConnection.java:945)
      at org.mortbay.jetty.HttpParser.parseNext(HttpParser.java:756)
      at org.mortbay.jetty.HttpParser.parseAvailable(HttpParser.java:218)
      at org.mortbay.jetty.HttpConnection.handle(HttpConnection.java:404)
      at org.mortbay.io.nio.SelectChannelEndPoint.run(SelectChannelEndPoint.java:410)
      at org.mortbay.thread.QueuedThreadPool$PoolThread.run(QueuedThreadPool.java:582)

      I suppose, SEAM try get session from request after request had been recycled!
      I suppose too, this do SEAM ExceptionFilter.
      Primarily, I get java.lang.StackOverflowError:
      java.lang.StackOverflowError
      at java.util.Arrays.copyOf(Arrays.java:2883)
      at java.lang.AbstractStringBuilder.expandCapacity(AbstractStringBuilder.java:100)
      at java.lang.AbstractStringBuilder.append(AbstractStringBuilder.java:487)
      at java.lang.StringBuffer.append(StringBuffer.java:301)
      at org.apache.log4j.helpers.ISO8601DateFormat.format(ISO8601DateFormat.java:132)
      at java.text.DateFormat.format(DateFormat.java:316)
      at org.apache.log4j.helpers.PatternParser$DatePatternConverter.convert(PatternParser.java:444)
      at org.apache.log4j.helpers.PatternConverter.format(PatternConverter.java:64)
      at org.apache.log4j.PatternLayout.format(PatternLayout.java:503)
      at org.apache.log4j.WriterAppender.subAppend(WriterAppender.java:301)
      at org.apache.log4j.DailyRollingFileAppender.subAppend(DailyRollingFileAppender.java:358)
      at org.apache.log4j.WriterAppender.append(WriterAppender.java:159)
      at org.apache.log4j.AppenderSkeleton.doAppend(AppenderSkeleton.java:230)
      at org.apache.log4j.helpers.AppenderAttachableImpl.appendLoopOnAppenders(AppenderAttachableImpl.java:65)
      at org.apache.log4j.Category.callAppenders(Category.java:203)
      at org.apache.log4j.Category.forcedLog(Category.java:388)
      at org.apache.log4j.Category.log(Category.java:853)
      at org.jboss.seam.log.Log4JProvider.info(Log4JProvider.java:72)
      at org.jboss.seam.contexts.Contexts.startup(Contexts.java:303)
      at org.jboss.seam.contexts.Contexts.startup(Contexts.java:278)
      at org.jboss.seam.contexts.Lifecycle.beginSession(Lifecycle.java:191)
      .....

      and next I get java.lang.IllegalStateException: No SessionHandler or SessionManager during try login to webapp.

      Other words, if I get any error in SEAM webapp, and then try login again, I get this error:
      java.lang.IllegalStateException: No SessionHandler or SessionManager

      1. How I may do workaroud this bug or may be this bug already resolved ?
      2. How I may switch off SEAM ExceptionFilter ?
      3. This problem reproduce in slow environment. At fast server, this issue catch very difficult. This is race condition between work jetty thread and session listener.

        Gliffy Diagrams

          Attachments

            Activity

              People

              • Assignee:
                Unassigned
                Reporter:
                JohnBat26 Eugene Batogov
              • Votes:
                0 Vote for this issue
                Watchers:
                1 Start watching this issue

                Dates

                • Created:
                  Updated:

                  Time Tracking

                  Estimated:
                  Original Estimate - 1 day
                  1d
                  Remaining:
                  Remaining Estimate - 1 day
                  1d
                  Logged:
                  Time Spent - Not Specified
                  Not Specified