6 Replies Latest reply on Apr 12, 2012 8:27 AM by b69

    Intermittent JSF bootstrapping bug?

    nickarls

      Anyone seen the issue of JSF applications sometimes not starting up with an exception

       

      10:10:24,371 ERROR [org.apache.catalina.core.ContainerBase.[jboss.web].[default-host].[/LTK]] (http--127.0.0.1-8080-2) StandardWrapper.Throwable: java.lang.IllegalStateException: Application was not properly initialized at startup, could not find Factory: javax.faces.context.FacesContextFactory

      at javax.faces.FactoryFinder$FactoryManager.getFactory(FactoryFinder.java:804) [jboss-jsf-api_2.0_spec-1.0.0.Final.jar:1.0.0.Final]

      at javax.faces.FactoryFinder.getFactory(FactoryFinder.java:306) [jboss-jsf-api_2.0_spec-1.0.0.Final.jar:1.0.0.Final]

      at javax.faces.webapp.FacesServlet.init(FacesServlet.java:166) [jboss-jsf-api_2.0_spec-1.0.0.Final.jar:1.0.0.Final]

      at org.apache.catalina.core.StandardWrapper.loadServlet(StandardWrapper.java:1202) [jbossweb-7.0.1.Final.jar:7.1.0.Alpha1-SNAPSHOT]

      at org.apache.catalina.core.StandardWrapper.allocate(StandardWrapper.java:952) [jbossweb-7.0.1.Final.jar:7.1.0.Alpha1-SNAPSHOT]

      at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:188) [jbossweb-7.0.1.Final.jar:7.1.0.Alpha1-SNAPSHOT]

      at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:161) [jbossweb-7.0.1.Final.jar:7.1.0.Alpha1-SNAPSHOT]

      at org.jboss.as.web.NamingValve.invoke(NamingValve.java:57) [jboss-as-web-7.1.0.Alpha1-SNAPSHOT.jar:7.1.0.Alpha1-SNAPSHOT]

      at org.jboss.as.jpa.interceptor.WebNonTxEmCloserValve.invoke(WebNonTxEmCloserValve.java:49) [jboss-as-jpa-7.1.0.Alpha1-SNAPSHOT.jar:7.1.0.Alpha1-SNAPSHOT]

      at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:154) [jbossweb-7.0.1.Final.jar:7.1.0.Alpha1-SNAPSHOT]

      at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102) [jbossweb-7.0.1.Final.jar:7.1.0.Alpha1-SNAPSHOT]

      at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109) [jbossweb-7.0.1.Final.jar:7.1.0.Alpha1-SNAPSHOT]

      at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:362) [jbossweb-7.0.1.Final.jar:7.1.0.Alpha1-SNAPSHOT]

      at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:877) [jbossweb-7.0.1.Final.jar:7.1.0.Alpha1-SNAPSHOT]

      at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:667) [jbossweb-7.0.1.Final.jar:7.1.0.Alpha1-SNAPSHOT]

      at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:952) [jbossweb-7.0.1.Final.jar:7.1.0.Alpha1-SNAPSHOT]

      at java.lang.Thread.run(Thread.java:722) [:1.7.0]

       

      10:10:24,374 ERROR [org.apache.catalina.core.ContainerBase.[jboss.web].[default-host].[/LTK].[FacesServlet]] (http--127.0.0.1-8080-2) Allocate exception for servlet FacesServlet: java.lang.IllegalStateException: Application was not properly initialized at startup, could not find Factory: javax.faces.context.FacesContextFactory

      at javax.faces.FactoryFinder$FactoryManager.getFactory(FactoryFinder.java:804) [jboss-jsf-api_2.0_spec-1.0.0.Final.jar:1.0.0.Final]

      at javax.faces.FactoryFinder.getFactory(FactoryFinder.java:306) [jboss-jsf-api_2.0_spec-1.0.0.Final.jar:1.0.0.Final]

      at javax.faces.webapp.FacesServlet.init(FacesServlet.java:166) [jboss-jsf-api_2.0_spec-1.0.0.Final.jar:1.0.0.Final]

      at org.apache.catalina.core.StandardWrapper.loadServlet(StandardWrapper.java:1202) [jbossweb-7.0.1.Final.jar:7.1.0.Alpha1-SNAPSHOT]

      at org.apache.catalina.core.StandardWrapper.allocate(StandardWrapper.java:952) [jbossweb-7.0.1.Final.jar:7.1.0.Alpha1-SNAPSHOT]

      at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:188) [jbossweb-7.0.1.Final.jar:7.1.0.Alpha1-SNAPSHOT]

      at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:161) [jbossweb-7.0.1.Final.jar:7.1.0.Alpha1-SNAPSHOT]

      at org.jboss.as.web.NamingValve.invoke(NamingValve.java:57) [jboss-as-web-7.1.0.Alpha1-SNAPSHOT.jar:7.1.0.Alpha1-SNAPSHOT]

      at org.jboss.as.jpa.interceptor.WebNonTxEmCloserValve.invoke(WebNonTxEmCloserValve.java:49) [jboss-as-jpa-7.1.0.Alpha1-SNAPSHOT.jar:7.1.0.Alpha1-SNAPSHOT]

      at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:154) [jbossweb-7.0.1.Final.jar:7.1.0.Alpha1-SNAPSHOT]

      at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102) [jbossweb-7.0.1.Final.jar:7.1.0.Alpha1-SNAPSHOT]

      at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109) [jbossweb-7.0.1.Final.jar:7.1.0.Alpha1-SNAPSHOT]

      at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:362) [jbossweb-7.0.1.Final.jar:7.1.0.Alpha1-SNAPSHOT]

      at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:877) [jbossweb-7.0.1.Final.jar:7.1.0.Alpha1-SNAPSHOT]

      at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:667) [jbossweb-7.0.1.Final.jar:7.1.0.Alpha1-SNAPSHOT]

      at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:952) [jbossweb-7.0.1.Final.jar:7.1.0.Alpha1-SNAPSHOT]

      at java.lang.Thread.run(Thread.java:722) [:1.7.0]

       

      Sometimes restarting the server helps, sometimes redeploying the application helps. This is usually something you see when you accidently put too much stuff in the deployment lib but this is not the case here. If there are other exceptions, they are swallowed because this is all I see.

        • 1. Re: Intermittent JSF bootstrapping bug?
          ssilvert

          I've seen that error while hacking on the overall JSF integration into AS.  It means that it can't find the JSF impl. 

           

          I looked at the Mojarra code for this and found this scary comment:

           

          // double check the current value.  Another thread
          // may have completed the initialization by the time
          // this thread entered this block
          factoryOrList = factories.get(factoryName);
          

           

          So maybe there is an improper implementation of the double-checked locking idiom? 

           

          Is there any way you can reproduce this consistently?

           

          Stan

          • 2. Re: Intermittent JSF bootstrapping bug?
            nickarls

            Unfortunately, I'm not able to reproduce it consistently. I have two apps with very similar architechture, with one I've never seen it, with the other for ~10% of deployments. I would to have 10 of these "problem apps" on the same AS7, it would be quite difficult the get them all up and running after a reboot etc :-/

             

            There are other forum posts that also could indicate this issue, e.g. http://community.jboss.org/message/619685#619685

             

            I just tested with a fresh upstream master build, made a project from the AS7 maven archetype, deployed, got a CNFE, added the dep, deployed but faces failed to bootstrap, redeployed the same app and this time it started.

            • 3. Re: Intermittent JSF bootstrapping bug?
              jason.greene

              To help debug this, can everyone who is experiencing this problem replace the jar:

               

              jboss-as-7.0.0.Final/modules/javax/faces/api/main/jboss-jsf-api_2.0_spec-1.0.1.Alpha1-SNAPSHOT.jar

               

              with the jar here:

               

              https://repository.jboss.org/nexus/service/local/repositories/snapshots/content/org/jboss/spec/javax/faces/jboss-jsf-api_2.0_spec/1.0.1.Alpha1-SNAPSHOT/jboss-jsf-api_2.0_spec-1.0.1.Alpha1-20110808.201236-1.jar

               

              As soon as you reproduce it it will dump two critical pieces of long info:

               

              15:11:20,325 SEVERE [javax.faces] (http--127.0.0.1-8080-1) No factory! Class loader is ModuleClassLoader for Module "deployment.junk.war:main" from Service Module Loader

              15:11:20,327 SEVERE [javax.faces] (http--127.0.0.1-8080-1) Module deployment.junk.war:main

               

              <module dump follows>

               

              If you could post those two lines and the following large dump of the module.

               

              If the dump is too big then attach it as a file.

               

              Thanks!!

              • 4. Re: Intermittent JSF bootstrapping bug?
                jason.greene

                Actually it's unlikely that its a module issue. Some of the factories are registered via a callback from the jsf impl. If for some reason a faces-config is not processed this could happen. I added some additional logging for when the factories are registered. If you could try this binary instead:

                 

                https://repository.jboss.org/nexus/service/local/repositories/snapshots/content/org/jboss/spec/javax/faces/jboss-jsf-api_2.0_spec/1.0.1.Alpha1-SNAPSHOT/jboss-jsf-api_2.0_spec-1.0.1.Alpha1-20110808.223924-2.jar

                 

                It now will log when the faces context factory (and others) is registered:

                 

                17:36:39,508 INFO  [javax.enterprise.resource.webcontainer.jsf.config] (MSC service thread 1-8) Initializing Mojarra 2.0.4 (FCS b09-jbossorg-4) for context '/jsf-injection'

                17:36:40,303 INFO  [javax.faces] (MSC service thread 1-8) Registering factory: javax.faces.application.ApplicationFactory impl com.sun.faces.application.ApplicationFactoryImpl

                17:36:40,304 INFO  [javax.faces] (MSC service thread 1-8) Registering factory: javax.faces.context.ExceptionHandlerFactory impl com.sun.faces.context.ExceptionHandlerFactoryImpl

                17:36:40,305 INFO  [javax.faces] (MSC service thread 1-8) Registering factory: javax.faces.component.visit.VisitContextFactory impl com.sun.faces.component.visit.VisitContextFactoryImpl

                17:36:40,305 INFO  [javax.faces] (MSC service thread 1-8) Registering factory: javax.faces.context.FacesContextFactory impl com.sun.faces.context.FacesContextFactoryImpl

                 

                This is supposed to happen *before* the faces servlet is initialized.

                • 5. Re: Intermittent JSF bootstrapping bug?
                  swd847

                  This is actually caused by a problem in Seam Faces. https://issues.jboss.org/browse/SEAMFACES-194

                  • 6. Re: Intermittent JSF bootstrapping bug?
                    b69

                    what is the actual state of this bug? I have a similar problem with my application, on trying to use Myfaces 2.1.7 with tomahawk 1.1.11. The application works almost! with the Mojarra-libraries. But tomahawk is required for the file-upload and the key-word is almost! So I have a good reason to move. Richfaces is not the first choice, because the application must run on WebSphere (8.x) too! Besides, the same error message is generated on enabling the myfaces-example-simple20-1.1.11.war see http://myfaces.apache.org/tomahawk/download.html ! The latter runs fine on Tomcat!

                    What is missing, who knows, how to run MyFaces on AS7? Note I’m using jbossAS7.1.2.SNAPSHOT.