glassfish
  1. glassfish
  2. GLASSFISH-13974

HttpSessionListener with form based login and @RequestScope CDI does not work

    Details

    • Type: Bug Bug
    • Status: Resolved
    • Priority: Major Major
    • Resolution: Fixed
    • Affects Version/s: 3.1
    • Fix Version/s: 3.1_dev
    • Component/s: web_container
    • Labels:
      None
    • Environment:

      Operating System: All
      Platform: All

    • Issuezilla Id:
      13,974

      Description

      Suppose one have an application with form-based login and HttpSessionListener
      with @RequestScope CDI.
      Then it would have a stack trace as follows:
      org.jboss.weld.context.ContextNotActiveException: WELD-001303 No active contexts
      for scope type javax.enterprise.context.RequestScoped
      at org.jboss.weld.manager.BeanManagerImpl.getContext(BeanManagerImpl.java:629)
      at
      org.jboss.weld.bean.proxy.ContextBeanInstance.getInstance(ContextBeanInstance.java:73)
      at
      org.jboss.weld.bean.proxy.AbstractBeanInstance.invoke(AbstractBeanInstance.java:48)
      at test.MyBean_$$WeldProxy.getText(MyBean$$_WeldProxy.java)
      at test.TestHttpSessionListener.sessionCreated(TestHttpSessionListener.java:52)
      at org.apache.catalina.session.StandardSession.tellNew(StandardSession.java:475)
      at org.apache.catalina.session.StandardSession.setId(StandardSession.java:407)
      at org.apache.catalina.session.ManagerBase.createSession(ManagerBase.java:763)
      at
      org.apache.catalina.session.StandardManager.createSession(StandardManager.java:311)
      at org.apache.catalina.connector.Request.doGetSession(Request.java:2897)
      at org.apache.catalina.connector.Request.getSessionInternal(Request.java:2754)
      at
      org.apache.catalina.authenticator.AuthenticatorBase.getSession(AuthenticatorBase.java:829)
      at
      org.apache.catalina.authenticator.FormAuthenticator.authenticate(FormAuthenticator.java:295)
      at
      org.apache.catalina.authenticator.AuthenticatorBase.processSecurityCheck(AuthenticatorBase.java:974)
      at
      org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:586)
      at org.apache.catalina.core.StandardPipeline.doInvoke(StandardPipeline.java:623)
      at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:595)
      at com.sun.enterprise.web.WebPipeline.invoke(WebPipeline.java:98)
      at
      com.sun.enterprise.web.PESessionLockingStandardPipeline.invoke(PESessionLockingStandardPipeline.java:91)
      at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:162)
      at org.apache.catalina.connector.CoyoteAdapter.doService(CoyoteAdapter.java:326)

      In fact, one has the following exception when there is no explicit
      HttpSessionListener in the application.
      org.jboss.weld.context.ContextNotActiveException: WELD-001303 No active contexts
      for scope type javax.enterprise.context.RequestScoped
      at org.jboss.weld.manager.BeanManagerImpl.getContext(BeanManagerImpl.java:629)
      at
      org.jboss.weld.bean.proxy.ContextBeanInstance.getInstance(ContextBeanInstance.java:73)
      at
      org.jboss.weld.bean.proxy.AbstractBeanInstance.invoke(AbstractBeanInstance.java:48)
      at
      org.jboss.weld.servlet.HttpSessionManager_$$WeldProxy.setSession(HttpSessionManager$$_WeldProxy.java)
      at org.jboss.weld.servlet.ServletLifecycle.cacheSession(ServletLifecycle.java:167)
      at
      org.jboss.weld.servlet.ServletLifecycle.restoreSessionContext(ServletLifecycle.java:161)
      at org.jboss.weld.servlet.ServletLifecycle.beginSession(ServletLifecycle.java:142)
      at org.jboss.weld.servlet.WeldListener.sessionCreated(WeldListener.java:126)

        Activity

        Hide
        Shing Wai Chan added a comment -

        Sending
        web-core/src/main/java/org/apache/catalina/core/ApplicationDispatcher.java
        Sending web-core/src/main/java/org/apache/catalina/core/Constants.java
        Sending
        web-core/src/main/java/org/apache/catalina/core/StandardContextValve.java
        Sending
        web-core/src/main/java/org/apache/catalina/core/StandardHostValve.java
        Transmitting file data ....
        Committed revision 41724.

        Note that this fix simplify the fixes in the following:
        Issue 11504 is about CDI with jsf login page.
        Issue 12642 is related to usage of CDI with JSR 196

        Add test case:
        Sending build.xml
        Adding weldJsfFormLoginHttpSessionListener
        Adding weldJsfFormLoginHttpSessionListener/WebTest.java
        Adding weldJsfFormLoginHttpSessionListener/build.properties
        Adding weldJsfFormLoginHttpSessionListener/build.xml
        Adding weldJsfFormLoginHttpSessionListener/descriptor
        Adding weldJsfFormLoginHttpSessionListener/descriptor/beans.xml
        Adding weldJsfFormLoginHttpSessionListener/descriptor/glassfish-web.xml
        Adding weldJsfFormLoginHttpSessionListener/descriptor/web.xml
        Adding weldJsfFormLoginHttpSessionListener/docroot
        Adding weldJsfFormLoginHttpSessionListener/docroot/login.jsp
        Adding weldJsfFormLoginHttpSessionListener/docroot/login_error.jsp
        Adding weldJsfFormLoginHttpSessionListener/docroot/message.xhtml
        Adding weldJsfFormLoginHttpSessionListener/src
        Adding weldJsfFormLoginHttpSessionListener/src/test
        Adding weldJsfFormLoginHttpSessionListener/src/test/MyBean.java
        Adding
        weldJsfFormLoginHttpSessionListener/src/test/TestHttpSessionListener.java
        Adding weldJsfFormLoginHttpSessionListener/src/test/TestMessage.java
        Transmitting file data .............
        Committed revision 41726.

        Show
        Shing Wai Chan added a comment - Sending web-core/src/main/java/org/apache/catalina/core/ApplicationDispatcher.java Sending web-core/src/main/java/org/apache/catalina/core/Constants.java Sending web-core/src/main/java/org/apache/catalina/core/StandardContextValve.java Sending web-core/src/main/java/org/apache/catalina/core/StandardHostValve.java Transmitting file data .... Committed revision 41724. Note that this fix simplify the fixes in the following: Issue 11504 is about CDI with jsf login page. Issue 12642 is related to usage of CDI with JSR 196 Add test case: Sending build.xml Adding weldJsfFormLoginHttpSessionListener Adding weldJsfFormLoginHttpSessionListener/WebTest.java Adding weldJsfFormLoginHttpSessionListener/build.properties Adding weldJsfFormLoginHttpSessionListener/build.xml Adding weldJsfFormLoginHttpSessionListener/descriptor Adding weldJsfFormLoginHttpSessionListener/descriptor/beans.xml Adding weldJsfFormLoginHttpSessionListener/descriptor/glassfish-web.xml Adding weldJsfFormLoginHttpSessionListener/descriptor/web.xml Adding weldJsfFormLoginHttpSessionListener/docroot Adding weldJsfFormLoginHttpSessionListener/docroot/login.jsp Adding weldJsfFormLoginHttpSessionListener/docroot/login_error.jsp Adding weldJsfFormLoginHttpSessionListener/docroot/message.xhtml Adding weldJsfFormLoginHttpSessionListener/src Adding weldJsfFormLoginHttpSessionListener/src/test Adding weldJsfFormLoginHttpSessionListener/src/test/MyBean.java Adding weldJsfFormLoginHttpSessionListener/src/test/TestHttpSessionListener.java Adding weldJsfFormLoginHttpSessionListener/src/test/TestMessage.java Transmitting file data ............. Committed revision 41726.

          People

          • Assignee:
            Shing Wai Chan
            Reporter:
            Shing Wai Chan
          • Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved: