3 Replies Latest reply on Feb 12, 2011 8:34 PM by infinity2heaven

    Context is already active exeption

    emmanuil emmanuil Newbie

      Hi, I get error when try load any page on my jsf 2.0 application. Tomcat 7.0.6, JSF 2.0.


      java.lang.IllegalStateException: Context is already active
           at org.jboss.weld.context.AbstractConversationContext.activate(AbstractConversationContext.java:301)
           at org.jboss.weld.jsf.WeldPhaseListener.activateConversations(WeldPhaseListener.java:110)
           at org.jboss.weld.jsf.WeldPhaseListener.beforePhase(WeldPhaseListener.java:84)
           at com.sun.faces.lifecycle.Phase.handleBeforePhase(Phase.java:224)
           at com.sun.faces.lifecycle.Phase.doPhase(Phase.java:95)
           at com.sun.faces.lifecycle.RestoreViewPhase.doPhase(RestoreViewPhase.java:107)
           at com.sun.faces.lifecycle.LifecycleImpl.execute(LifecycleImpl.java:114)
           at javax.faces.webapp.FacesServlet.service(FacesServlet.java:308)
           at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:306)
           at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210)
           at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:240)
           at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:161)
           at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:164)
           at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:100)
           at org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:550)
           at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:118)
           at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:380)
           at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:243)
           at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:188)
           at org.apache.tomcat.util.net.JIoEndpoint$SocketProcessor.run(JIoEndpoint.java:288)
           at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886)
           at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908)
           at java.lang.Thread.run(Thread.java:662)



      In web.xml I have:


      <listener>
              <listener-class>org.jboss.weld.environment.servlet.Listener</listener-class>
      </listener>
      


      And have dependencies:


              <dependency>
                  <groupId>org.jboss.weld.servlet</groupId>
                  <artifactId>weld-servlet</artifactId>
                  <version>1.1.0.Final</version>
              </dependency>
              <dependency>
                  <groupId>org.jboss.weld.servlet</groupId>
                  <artifactId>weld-servlet-core</artifactId>
                  <version>1.1.0.Final</version>
              </dependency>
      



      In glassfish v3 my app work well.
      I don't know what the matter. :(
      Any ideas?

        • 1. Re: Context is already active exeption
          Jeff Howard Newbie

          Have you made certain that you only have one copy of weld in your WEB-INF/lib? 

          For weld-1.1 on tomcat the only weld-*.jar you need is weld-servlet.jar

          • 2. Re: Context is already active exeption
            emmanuil emmanuil Newbie

            Thank you, Jeff!!! This is was a problem. I remove weld-servlet-core from dependencies and no longer get this exception. But get java.lang.NoSuchMethodException. I will found out.
            Thank you again!

            • 3. Re: Context is already active exeption
              infinity2heaven Novice

              I get the same error and I don't have a duplicate Weld jar in WEB-INF/lib. I use JBOSS AS 6.1.SNAPSHOT.


              It happens only during @ConversationScoped Stateful bean when returning a viewId instead of configuring the navigation through faces-config. For details on the code, refer to related thread here.



              java.lang.IllegalStateException: Context is already active
                   at org.jboss.weld.context.AbstractConversationContext.activate(AbstractConversationContext.java:301)
                   at org.jboss.weld.jsf.WeldPhaseListener.activateConversations(WeldPhaseListener.java:110)
                   at org.jboss.weld.jsf.WeldPhaseListener.beforePhase(WeldPhaseListener.java:84)
                   at com.sun.faces.lifecycle.Phase.handleBeforePhase(Phase.java:228)
                   at com.sun.faces.lifecycle.Phase.doPhase(Phase.java:99)
                   at com.sun.faces.lifecycle.RestoreViewPhase.doPhase(RestoreViewPhase.java:113)
                   at com.sun.faces.lifecycle.LifecycleImpl.execute(LifecycleImpl.java:118)