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

IdentityRequestWrapper should not always create a new Http Session

    Details

    • Type: Bug
    • Status: Open (View Workflow)
    • Priority: Optional
    • Resolution: Unresolved
    • Affects Version/s: 2.1.2.GA
    • Fix Version/s: None
    • Component/s: JSF Integration
    • Labels:
      None
    • Estimated Difficulty:
      Low

      Description

      We have on production a Seam / Icefaces application. This application is used during the day by users to enter some data.
      The same application is used during the night to run some batches.

      These batches are run using Web Services, that starts Seam and run EJB3 stateless sessions beans.

      From time to time, the web services call fails during the night, with the following error:

      010-11-19 00:16:36,520 ERROR [org.apache.catalina.core.ContainerBase] "Servlet.service()" pour la servlet WsServlet a g?n?r? une exception
      java.lang.IllegalStateException: Cannot create a session after the response has been committed
      at org.apache.catalina.connector.Request.doGetSession(Request.java:2282)
      at org.apache.catalina.connector.Request.getSession(Request.java:2064)
      at org.apache.catalina.connector.RequestFacade.getSession(RequestFacade.java:833)
      at org.apache.catalina.connector.RequestFacade.getSession(RequestFacade.java:844)
      at org.jboss.seam.web.IdentityRequestWrapper.<init>(IdentityRequestWrapper.java:23)
      at org.jboss.seam.web.IdentityFilter.doFilter(IdentityFilter.java:40)
      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.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
      at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
      at org.jboss.web.tomcat.filters.ReplyHeaderFilter.doFilter(ReplyHeaderFilter.java:96)
      at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
      at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
      at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:230)
      at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:173)
      at org.jboss.web.tomcat.security.SecurityAssociationValve.invoke(SecurityAssociationValve.java:182)
      at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:433)
      at org.jboss.web.tomcat.security.JaccContextValve.invoke(JaccContextValve.java:84)
      at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:128)
      at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:104)
      at org.jboss.web.tomcat.service.jca.CachedConnectionValve.invoke(CachedConnectionValve.java:157)
      at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
      at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:241)
      at org.apache.coyote.ajp.AjpProcessor.process(AjpProcessor.java:437)
      at org.apache.coyote.ajp.AjpProtocol$AjpConnectionHandler.process(AjpProtocol.java:381)
      at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:447)
      at java.lang.Thread.run(Thread.java:595)

      I really don't understand why this error occurs, because we are in a filter, but looking at the code in IndentityRequestWrapper, I see:

      public IdentityRequestWrapper(HttpServletRequest request)

      { super(request); identity = (Identity) request.getSession(). getAttribute(Seam.getComponentName(Identity.class)); }

      ==> Notice the getSession(), that forces creation of a new session.
      I think a better idea is to call getSession(false), so that no session gets created as a side effect?

      Regards,

      GCC.

        Gliffy Diagrams

          Attachments

            Activity

              People

              • Assignee:
                Unassigned
                Reporter:
                gcollin Gerard COLLIN
              • Votes:
                0 Vote for this issue
                Watchers:
                0 Start watching this issue

                Dates

                • Created:
                  Updated: