Uploaded image for project: 'Weld'
  1. Weld
  2. WELD-877

"IllegalStateException: Context is already active" when error-page of exception-type com.sun.faces.context.FacesFileNotFoundException

    Details

    • Steps to Reproduce:
      Hide

      1. deploy war attached to this issue

      2. access "http://localhost/jsf-error/x.xhtml" (or any missing *.xhtml)

      3. A 500 error is displayed instead of forwarding to "/notFound.xhtml" as configured in web.xml

      Show
      1. deploy war attached to this issue 2. access "http://localhost/jsf-error/x.xhtml" (or any missing *.xhtml) 3. A 500 error is displayed instead of forwarding to "/notFound.xhtml" as configured in web.xml
    • Similar Issues:
      Show 10 results 

      Description

      Weld throws an exception of "IllegalStateException: Context is already active" when attempting to access a facelets page that doesn't exist (one that matches the url-pattern for the FacesServlet).

      Attached is a minimal war (contains no class files) which exhibits this error.

      The web application works if the "WEB-INF/beans.xml" file is removed (not a solution for an application using Weld).

      Simplified stack trace is:

      [#|2011-03-31T20:16:28.406+1000|WARNING|glassfish3.1|javax.enterprise.system.container.web.com.sun.enterprise.web|_ThreadID=169;_ThreadName=Thread-2;|org.apache.catalina.core.StandardHostValve@1042d3b: Exception Processing ErrorPage[exceptionType=com.sun.faces.context.FacesFileNotFoundException, location=/notFound.xhtml]
      javax.servlet.ServletException: Context is already active
      at javax.faces.webapp.FacesServlet.service(FacesServlet.java:422)
      at org.apache.catalina.core.StandardWrapper.service(StandardWrapper.java:1534)
      ...
      Caused by: 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)
      at javax.faces.webapp.FacesServlet.service(FacesServlet.java:409)
      ... 27 more

        Gliffy Diagrams

          Activity

          Hide
          cory_prowse Cory Prowse added a comment -

          Minimal war which exhibits error.

          Contents of war:
          index.xhtml
          notFound.xhtml
          WEB-INF/beans.xml
          WEB-INF/faces-config.xml
          WEB-INF/sun-web.xml
          WEB-INF/web.xml
          META-INF/MANIFEST.MF

          Show
          cory_prowse Cory Prowse added a comment - Minimal war which exhibits error. Contents of war: index.xhtml notFound.xhtml WEB-INF/beans.xml WEB-INF/faces-config.xml WEB-INF/sun-web.xml WEB-INF/web.xml META-INF/MANIFEST.MF
          Hide
          neyrick Eric Demorsy added a comment -

          My issue with Seam Faces viewAction might be related, just posted it on the forums right here

          I'll post my war if someone's interested

          Show
          neyrick Eric Demorsy added a comment - My issue with Seam Faces viewAction might be related, just posted it on the forums right here I'll post my war if someone's interested
          Hide
          pmuir Pete Muir added a comment -

          Cory can you make a htmlunit + arquillian test for this? Would be most useful!

          Show
          pmuir Pete Muir added a comment - Cory can you make a htmlunit + arquillian test for this? Would be most useful!
          Hide
          cory_prowse Cory Prowse added a comment -

          I'm not sure when I'll get the time to create an Arquillian test for it.

          (mainly cos I need to come up to speed on it first - have never used it)

          Sorry, may not be for weeks.

          Show
          cory_prowse Cory Prowse added a comment - I'm not sure when I'll get the time to create an Arquillian test for it. (mainly cos I need to come up to speed on it first - have never used it) Sorry, may not be for weeks.
          Hide
          lincolnthree Lincoln Baxter III added a comment -

          IMO, Weld should not be throwing exceptions if the Context is already active. Simply re-attach to the existing context. Even a simple servlet forward() will break WELD if using JSF and Conversations.

          Show
          lincolnthree Lincoln Baxter III added a comment - IMO, Weld should not be throwing exceptions if the Context is already active. Simply re-attach to the existing context. Even a simple servlet forward() will break WELD if using JSF and Conversations.
          Hide
          lincolnthree Lincoln Baxter III added a comment -
          Show
          lincolnthree Lincoln Baxter III added a comment - Pull request sent: https://github.com/weld/core/pull/141
          Hide
          lincolnthree Lincoln Baxter III added a comment -

          Please assign to me if you get the chance. Thanks.

          Show
          lincolnthree Lincoln Baxter III added a comment - Please assign to me if you get the chance. Thanks.

            People

            • Assignee:
              lincolnthree Lincoln Baxter III
              Reporter:
              cory_prowse Cory Prowse
            • Votes:
              4 Vote for this issue
              Watchers:
              8 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved:

                Development