5 Replies Latest reply on Aug 20, 2010 9:19 AM by Wang Liyu

    Multiple weld modules war packaging problem

    Wang Liyu Apprentice

      I have several weld modules (packaged with META-INF/beans.xml), I use maven archive to generated simple servlet project, and if I put these jars into WEB-INF/lib, it deployed successfully and when I first visit the page I got exception, here is on the GF3.0.1:


      If I removed these jars, it works fine. did I missing something?




      SEVERE: 634 [http-thread-pool-13121-(2)] INFO org.jboss.weld.environment.servlet.Listener - No supported servlet container detected, JSR-299 injection will NOT be available in Servlets, Filters etc.
      
      INFO: Loading application cdi_test-cdi_war_1.0.0-SNAPSHOT at /test-cdi
      INFO: cdi_test-cdi_war_1.0.0-SNAPSHOT was successfully deployed in 1,995 milliseconds.
      INFO: HelloWorld was constructed
      WARNING: StandardWrapperValve[Faces Servlet]: PWC1406: Servlet.service() for servlet Faces Servlet threw exception
      org.jboss.weld.context.ContextNotActiveException: WELD-001303 No active contexts for scope type @ConversationScoped
              at org.jboss.weld.conversation.ConversationImpl.checkConversationActive(ConversationImpl.java:79)
              at org.jboss.weld.conversation.ConversationImpl.isTransient(ConversationImpl.java:234)
              at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
              at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
              at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
              at java.lang.reflect.Method.invoke(Method.java:597)
              at org.jboss.weld.util.reflection.SecureReflections$13.work(SecureReflections.java:304)
              at org.jboss.weld.util.reflection.SecureReflectionAccess.run(SecureReflectionAccess.java:54)
              at org.jboss.weld.util.reflection.SecureReflectionAccess.runAsInvocation(SecureReflectionAccess.java:163)
              at org.jboss.weld.util.reflection.SecureReflections.invoke(SecureReflections.java:298)
              at org.jboss.weld.bean.proxy.ClientProxyMethodHandler.invoke(ClientProxyMethodHandler.java:113)
              at org.jboss.weld.util.CleanableMethodHandler.invoke(CleanableMethodHandler.java:43)
              at org.jboss.weld.conversation.ConversationImpl_$$_javassist_43.isTransient(ConversationImpl_$$_javassist_43.java)
              at org.jboss.weld.conversation.AbstractConversationManager.cleanupConversation(AbstractConversationManager.java:148)
              at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
              at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
              at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
              at java.lang.reflect.Method.invoke(Method.java:597)
              at org.jboss.weld.util.reflection.SecureReflections$13.work(SecureReflections.java:304)
              at org.jboss.weld.util.reflection.SecureReflectionAccess.run(SecureReflectionAccess.java:54)
              at org.jboss.weld.util.reflection.SecureReflectionAccess.runAsInvocation(SecureReflectionAccess.java:163)
              at org.jboss.weld.util.reflection.SecureReflections.invoke(SecureReflections.java:298)
              at org.jboss.weld.bean.proxy.ClientProxyMethodHandler.invoke(ClientProxyMethodHandler.java:113)
              at org.jboss.weld.util.CleanableMethodHandler.invoke(CleanableMethodHandler.java:43)
              at org.jboss.weld.conversation.ServletConversationManager_$$_javassist_42.cleanupConversation(ServletConversationManager_$$_javassist_42.java)
              at org.jboss.weld.jsf.WeldPhaseListener.afterRenderResponse(WeldPhaseListener.java:131)
              at org.jboss.weld.jsf.WeldPhaseListener.afterPhase(WeldPhaseListener.java:103)
              at com.sun.faces.lifecycle.Phase.handleAfterPhase(Phase.java:189)
              at com.sun.faces.lifecycle.Phase.doPhase(Phase.java:107)
              at com.sun.faces.lifecycle.LifecycleImpl.render(LifecycleImpl.java:139)
              at javax.faces.webapp.FacesServlet.service(FacesServlet.java:313)
              at org.apache.catalina.core.StandardWrapper.service(StandardWrapper.java:1523)
              at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:279)
              at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:188)
              at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:641)
              at com.sun.enterprise.web.WebPipeline.invoke(WebPipeline.java:97)
              at com.sun.enterprise.web.PESessionLockingStandardPipeline.invoke(PESessionLockingStandardPipeline.java:85)
              at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:185)
              at org.apache.catalina.connector.CoyoteAdapter.doService(CoyoteAdapter.java:325)
              at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:226)
              at com.sun.enterprise.v3.services.impl.ContainerMapper.service(ContainerMapper.java:165)
              at com.sun.grizzly.http.ProcessorTask.invokeAdapter(ProcessorTask.java:791)
              at com.sun.grizzly.http.ProcessorTask.doProcess(ProcessorTask.java:693)
              at com.sun.grizzly.http.ProcessorTask.process(ProcessorTask.java:954)
              at com.sun.grizzly.http.DefaultProtocolFilter.execute(DefaultProtocolFilter.java:170)
              at com.sun.grizzly.DefaultProtocolChain.executeProtocolFilter(DefaultProtocolChain.java:135)
              at com.sun.grizzly.DefaultProtocolChain.execute(DefaultProtocolChain.java:102)
              at com.sun.grizzly.DefaultProtocolChain.execute(DefaultProtocolChain.java:88)
              at com.sun.grizzly.http.HttpProtocolChain.execute(HttpProtocolChain.java:76)
              at com.sun.grizzly.ProtocolChainContextTask.doCall(ProtocolChainContextTask.java:53)
              at com.sun.grizzly.SelectionKeyContextTask.call(SelectionKeyContextTask.java:57)
              at com.sun.grizzly.ContextTask.run(ContextTask.java:69)
              at com.sun.grizzly.util.AbstractThreadPool$Worker.doWork(AbstractThreadPool.java:330)
              at com.sun.grizzly.util.AbstractThreadPool$Worker.run(AbstractThreadPool.java:309)
              at java.lang.Thread.run(Thread.java:619)




        • 1. Re: Multiple weld modules war packaging problem
          Wang Liyu Apprentice

          It is weird, if I remove the interceptors session from the jar's beans.xml, it can deploy and works fine, and idea?

          • 2. Re: Multiple weld modules war packaging problem
            Wang Liyu Apprentice

            I was wrong, it never works, it's easy to reproduce, create weld-jsf-servlet-minimal project, add weld-extensitions dependency to the pom.xml:




            <dependency>
                     <groupId>org.jboss.weld</groupId>
                     <artifactId>weld-extensions</artifactId>
                     <version>1.0.0.Alpha2</version>
                  </dependency>
            




            and run with GF3.0.1, it will show the exceptions:




            WARNING: StandardWrapperValve[Faces Servlet]: PWC1406: Servlet.service() for servlet Faces Servlet threw exception
            org.jboss.weld.context.ContextNotActiveException: WELD-001303 No active contexts for scope type @ConversationScoped
                    at org.jboss.weld.conversation.ConversationImpl.checkConversationActive(ConversationImpl.java:79)
                    at org.jboss.weld.conversation.ConversationImpl.isTransient(ConversationImpl.java:234)
                    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
                    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
                    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
                    at java.lang.reflect.Method.invoke(Method.java:597)
                    at org.jboss.weld.util.reflection.SecureReflections$13.work(SecureReflections.java:304)
                    at org.jboss.weld.util.reflection.SecureReflectionAccess.run(SecureReflectionAccess.java:54)
                    at org.jboss.weld.util.reflection.SecureReflectionAccess.runAsInvocation(SecureReflectionAccess.java:163)
                    at org.jboss.weld.util.reflection.SecureReflections.invoke(SecureReflections.java:298)
                    at org.jboss.weld.bean.proxy.ClientProxyMethodHandler.invoke(ClientProxyMethodHandler.java:113)
                    at org.jboss.weld.util.CleanableMethodHandler.invoke(CleanableMethodHandler.java:43)
                    at org.jboss.weld.conversation.ConversationImpl_$$_javassist_46.isTransient(ConversationImpl_$$_javassist_46.java)
                    at org.jboss.weld.conversation.AbstractConversationManager.cleanupConversation(AbstractConversationManager.java:148)
                    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
                    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
                    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
                    at java.lang.reflect.Method.invoke(Method.java:597)
                    at org.jboss.weld.util.reflection.SecureReflections$13.work(SecureReflections.java:304)
                    at org.jboss.weld.util.reflection.SecureReflectionAccess.run(SecureReflectionAccess.java:54)
                    at org.jboss.weld.util.reflection.SecureReflectionAccess.runAsInvocation(SecureReflectionAccess.java:163)
                    at org.jboss.weld.util.reflection.SecureReflections.invoke(SecureReflections.java:298)
                    at org.jboss.weld.bean.proxy.ClientProxyMethodHandler.invoke(ClientProxyMethodHandler.java:113)
                    at org.jboss.weld.util.CleanableMethodHandler.invoke(CleanableMethodHandler.java:43)
                    at org.jboss.weld.conversation.ServletConversationManager_$$_javassist_45.cleanupConversation(ServletConversationManager_$$_javassist_45.java)
                    at org.jboss.weld.jsf.WeldPhaseListener.afterRenderResponse(WeldPhaseListener.java:131)
                    at org.jboss.weld.jsf.WeldPhaseListener.afterPhase(WeldPhaseListener.java:103)
                    at com.sun.faces.lifecycle.Phase.handleAfterPhase(Phase.java:189)
                    at com.sun.faces.lifecycle.Phase.doPhase(Phase.java:107)
                    at com.sun.faces.lifecycle.LifecycleImpl.render(LifecycleImpl.java:139)
                    at javax.faces.webapp.FacesServlet.service(FacesServlet.java:313)
                    at org.apache.catalina.core.StandardWrapper.service(StandardWrapper.java:1523)
                    at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:279)
                    at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:188)
                    at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:641)
                    at com.sun.enterprise.web.WebPipeline.invoke(WebPipeline.java:97)
                    at com.sun.enterprise.web.PESessionLockingStandardPipeline.invoke(PESessionLockingStandardPipeline.java:85)
                    at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:185)
                    at org.apache.catalina.connector.CoyoteAdapter.doService(CoyoteAdapter.java:325)
                    at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:226)
                    at com.sun.enterprise.v3.services.impl.ContainerMapper.service(ContainerMapper.java:165)
                    at com.sun.grizzly.http.ProcessorTask.invokeAdapter(ProcessorTask.java:791)
                    at com.sun.grizzly.http.ProcessorTask.doProcess(ProcessorTask.java:693)
                    at com.sun.grizzly.http.ProcessorTask.process(ProcessorTask.java:954)
                    at com.sun.grizzly.http.DefaultProtocolFilter.execute(DefaultProtocolFilter.java:170)
                    at com.sun.grizzly.DefaultProtocolChain.executeProtocolFilter(DefaultProtocolChain.java:135)
                    at com.sun.grizzly.DefaultProtocolChain.execute(DefaultProtocolChain.java:102)
                    at com.sun.grizzly.DefaultProtocolChain.execute(DefaultProtocolChain.java:88)
                    at com.sun.grizzly.http.HttpProtocolChain.execute(HttpProtocolChain.java:76)
                    at com.sun.grizzly.ProtocolChainContextTask.doCall(ProtocolChainContextTask.java:53)
                    at com.sun.grizzly.SelectionKeyContextTask.call(SelectionKeyContextTask.java:57)
                    at com.sun.grizzly.ContextTask.run(ContextTask.java:69)
                    at com.sun.grizzly.util.AbstractThreadPool$Worker.doWork(AbstractThreadPool.java:330)
                    at com.sun.grizzly.util.AbstractThreadPool$Worker.run(AbstractThreadPool.java:309)
                    at java.lang.Thread.run(Thread.java:619)
            



            • 3. Re: Multiple weld modules war packaging problem
              Wang Liyu Apprentice
              I have tried 3 servers:

              GF3.0.1 --> not working
              Tomcat6 --> works
              JBoss6M4 --> works

              Did anybody find same issue before?
              • 4. Re: Multiple weld modules war packaging problem
                Pete Muir Master

                You don't want to use weld-servlet in GlassFish, it has built in support for CDI, so you will find that nothing works, as both your bundled Weld, and the built in Weld conflict.

                • 5. Re: Multiple weld modules war packaging problem
                  Wang Liyu Apprentice

                  Thanks, I finally got it works with GFv3. In case someone has same problem, here is some hint:


                  If you want to deploy on JBoss6 or GFv3, use weld-jsf-jee-minimal and weld-jsf-jee archetypes to generate the project.
                  If you want to deploy on TC or Jetty, use weld-jsf-servlet-minimal archetype.


                  In order to use JBoss-EL2.0GA in TC env, you need to do the following steps:


                  1, replace


                  %CATALINA_HOME%/lib/el-api.jar with el-api-2.2.jar




                  2, in the pom.xml, add




                  <dependency>
                              <groupId>org.jboss.seam</groupId>
                              <artifactId>jboss-el</artifactId>
                              <version>2.0.0.GA</version>
                              <scope>runtime</scope>
                              <exclusions>
                                  <exclusion>
                                      <groupId>javax.el</groupId>
                                      <artifactId>el-api</artifactId>
                                  </exclusion>
                              </exclusions>
                          </dependency>



                  3, in the web.xml, add




                  <context-param>
                          <param-name>com.sun.faces.expressionFactory</param-name>
                          <param-value>org.jboss.el.ExpressionFactoryImpl</param-value>
                      </context-param>





                  then you can use ${something.action(params)} expression in TC6.