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

        Activity

        Hide
        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
        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
        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
        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
        Pete Muir
        added a comment -

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

        Show
        Pete Muir
        added a comment - Cory can you make a htmlunit + arquillian test for this? Would be most useful!
        Hide
        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
        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
        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
        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
        Lincoln Baxter III
        added a comment -
        Show
        Lincoln Baxter III
        added a comment - Pull request sent: https://github.com/weld/core/pull/141
        Hide
        Lincoln Baxter III
        added a comment -

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

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

          People

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

            Dates

            • Created:
              Updated:
              Resolved: