10 Replies Latest reply on Jul 4, 2018 4:58 AM by rchilla0601

    JBoss7: java.lang.InstantiationException: org.jboss.as.weld.webtier.jsf.WeldApplicationFactory

    rumiat

      I am deploying seam 2 application in JBoss 7 and getting following exception while startup. Any idea?

       

      ERROR [org.apache.catalina.core.ContainerBase.[jboss.web].[default-host].[/myapp]] (MSC service thread 1-1) Exception sending context initialized event to listener instance of class com.sun.faces.config.ConfigureListener: com.sun.faces.config.ConfigurationException: CONFIGURATION FAILED! org.jboss.as.weld.webtier.jsf.WeldApplicationFactory

          at com.sun.faces.config.ConfigManager.initialize(ConfigManager.java:215) [jsf-impl-1.2_13.jar:1.2_13-b01-FCS]

          at com.sun.faces.config.ConfigureListener.contextInitialized(ConfigureListener.java:196) [jsf-impl-1.2_13.jar:1.2_13-b01-FCS]

          at org.apache.catalina.core.StandardContext.contextListenerStart(StandardContext.java:3368) [jbossweb-7.0.0.CR4.jar:7.0.0.Final]

          at org.apache.catalina.core.StandardContext.start(StandardContext.java:3821) [jbossweb-7.0.0.CR4.jar:7.0.0.Final]

          at org.jboss.as.web.deployment.WebDeploymentService.start(WebDeploymentService.java:70) [jboss-as-web-7.0.0.Final.jar:7.0.0.Final]

          at org.jboss.msc.service.ServiceControllerImpl$StartTask.run(ServiceControllerImpl.java:1765)

          at org.jboss.msc.service.ServiceControllerImpl$ClearTCCLTask.run(ServiceControllerImpl.java:2291)

          at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886) [:1.6.0_12]

          at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908) [:1.6.0_12]

          at java.lang.Thread.run(Thread.java:619) [:1.6.0_12]

      Caused by: java.lang.InstantiationException: org.jboss.as.weld.webtier.jsf.WeldApplicationFactory

          at java.lang.Class.newInstance0(Class.java:340) [:1.6.0_12]

          at java.lang.Class.newInstance(Class.java:308) [:1.6.0_12]

          at javax.faces.FactoryFinder.getImplGivenPreviousImpl(FactoryFinder.java:537) [jsf-api-1.2_13.jar:1.2_13-b01-FCS]

          at javax.faces.FactoryFinder.getImplementationInstance(FactoryFinder.java:405) [jsf-api-1.2_13.jar:1.2_13-b01-FCS]

          at javax.faces.FactoryFinder.access$400(FactoryFinder.java:135) [jsf-api-1.2_13.jar:1.2_13-b01-FCS]

          at javax.faces.FactoryFinder$FactoryManager.getFactory(FactoryFinder.java:717) [jsf-api-1.2_13.jar:1.2_13-b01-FCS]

          at javax.faces.FactoryFinder.getFactory(FactoryFinder.java:239) [jsf-api-1.2_13.jar:1.2_13-b01-FCS]

          at com.sun.faces.config.processor.FactoryConfigProcessor.verifyFactoriesExist(FactoryConfigProcessor.java:186) [jsf-impl-1.2_13.jar:1.2_13-b01-FCS]

          at com.sun.faces.config.processor.FactoryConfigProcessor.process(FactoryConfigProcessor.java:131) [jsf-impl-1.2_13.jar:1.2_13-b01-FCS]

          at com.sun.faces.config.ConfigManager.initialize(ConfigManager.java:205) [jsf-impl-1.2_13.jar:1.2_13-b01-FCS]

          ... 9 more

        • 1. Re: JBoss7: java.lang.InstantiationException: org.jboss.as.weld.webtier.jsf.WeldApplicationFactory
          jaikiran

          Try this against latest AS7 nightly build. It should be fixed there.

          • 2. Re: JBoss7: java.lang.InstantiationException: org.jboss.as.weld.webtier.jsf.WeldApplicationFactory
            rumiat

            I have tried that too but it dint work for me

            • 3. Re: JBoss7: java.lang.InstantiationException: org.jboss.as.weld.webtier.jsf.WeldApplicationFactory
              jaikiran

              Can you attach the application which reproduces this issue?

              • 4. Re: JBoss7: java.lang.InstantiationException: org.jboss.as.weld.webtier.jsf.WeldApplicationFactory
                dgarson

                Finally after a lot of troubleshooting, I have solved this bug.

                 

                It appears that despite the exclusion of the 'main' slot (JSF2) for the jsf-impl and jsf-api dependencies, the JSF2 implementation was being used when going through the Weld classloader. In order to correct this, you must go into your module.xml file for each of the Weld dependencies and change the dependency on "javax.faces.api" to use a slot="1.2" value (assuming the name for the JSF 1.2 implementation module slot was '1.2')

                 

                - David

                • 5. Re: JBoss7: java.lang.InstantiationException: org.jboss.as.weld.webtier.jsf.WeldApplicationFactory
                  rumiat

                  Wonderful!!! I really appreciate you!! I think that's the best way to do it so far.

                  • 6. Re: JBoss7: java.lang.InstantiationException: org.jboss.as.weld.webtier.jsf.WeldApplicationFactory
                    lucabur

                    Hi,

                    I have exactly the same issue, but unfortunately your solution is a little bit obsecure for me. Could you please clarify some points:

                    1. You say: "you must go into your module.xml file for each of the Weld dependencies ..." which module.xml are you referring to ?
                    2. Can you give an example of this modification on a module.xml sample file ?

                     

                    Thank you in advance.

                     

                    Luca Buraggi

                    • 7. Re: JBoss7: java.lang.InstantiationException: org.jboss.as.weld.webtier.jsf.WeldApplicationFactory
                      kennardconsulting

                      I believe David is referring to:

                      • modules/org/jboss/as/weld/main/module.xml
                      • modules/org/jboss/weld/core/main/module.xml

                      I added slot="1.2" to both of the...

                           <module name="javax.faces.api"/>

                      ...and it worked. You still need org.jboss.jbossfaces.JSF_CONFIG_NAME=Mojarra-1.2 in your web.xml, mind.

                       

                      Thanks David!

                      • 8. Re: JBoss7: java.lang.InstantiationException: org.jboss.as.weld.webtier.jsf.WeldApplicationFactory
                        devsisodia

                        I followed the link and it worked for me. Thanks a lot David!!!

                        AdditionalIy I  would like to have comments on below:

                        Below are two steps i have to additionally performed than described in migration documentation(https://access.redhat.com/site/documentation/en-US/JBoss_Enterprise_Application_Platform/6.1/html-single/Migration_Guide…) to upgrade seam2.2.2 and jsf1.2 richfaces 3.3.3. application. I need your expert advise as to this is really needed or this is result of some miss-configuration in my application?

                        1.Added dependency for google-gwt Reason: http://stackoverflow.com/questions/3003715/why-do-i-have-a-dependency-to-gwt <dependency> <groupId>com.google.gwt</groupId> <artifactId>gwt-servlet</artifactId> <scope>runtime</scope> <version>2.5.0</version> </dependency> Exception seen without above: 13:22:39,744 INFO [javax.servlet.ServletContextListener] (ServerService Thread Pool -- 168) Welcome to Seam 2.2.2.Final Caused by: java.lang.NoClassDefFoundError: com/google/gwt/user/server/rpc/SerializationPolicyProvider at java.lang.ClassLoader.defineClass1(Native Method) [rt.jar:1.7.0_25] at java.lang.ClassLoader.defineClass(ClassLoader.java:792) [rt.jar:1.7.0_25] at org.jboss.modules.ModuleClassLoader.doDefineOrLoadClass(ModuleClassLoader.java:344) [jboss-modules.jar:1.2.0.Final-redhat-1] at org.jboss.modules.ModuleClassLoader.defineClass(ModuleClassLoader.java:422) [jboss-modules.jar:1.2.0.Final-redhat-1] ... 46 more

                         

                        2.JBoss7: java.lang.InstantiationException: org.jboss.as.weld.webtier.jsf.WeldApplicationFactory


                         

                        But now I am facing another issue as described below. Please check it if you can help me. Thx

                         

                        Application is getting deployed successfully and landing page is also displayed in  browser. But after authentication user exception comes that shown below.

                        05:09:52,507 ERROR [org.jboss.seam.jsf.SeamPhaseListener] (http-/127.0.0.1:8080-4) swallowing exception: java.lang.IllegalStateException: No active application scope

                            at org.jboss.seam.core.Init.instance(Init.java:115) [jboss-seam-2.2.2.Final.jar:2.2.2.Final]

                            at org.jboss.seam.jsf.SeamPhaseListener.handleTransactionsBeforePhase(SeamPhaseListener.java:317) [jboss-seam-2.2.2.Final.jar:2.2.2.Final]

                            at org.jboss.seam.jsf.SeamPhaseListener.beforeServletPhase(SeamPhaseListener.java:143) [jboss-seam-2.2.2.Final.jar:2.2.2.Final]

                            at org.jboss.seam.jsf.SeamPhaseListener.beforePhase(SeamPhaseListener.java:117) [jboss-seam-2.2.2.Final.jar:2.2.2.Final]

                            at com.sun.faces.lifecycle.Phase.handleBeforePhase(Phase.java:214) [jsf-impl-1.2_15-b01-redhat-3.jar:1.2_15-b01-redhat-3]

                            at com.sun.faces.lifecycle.Phase.doPhase(Phase.java:96) [jsf-impl-1.2_15-b01-redhat-3.jar:1.2_15-b01-redhat-3]

                            at com.sun.faces.lifecycle.LifecycleImpl.render(LifecycleImpl.java:139) [jsf-impl-1.2_15-b01-redhat-3.jar:1.2_15-b01-redhat-3]

                            at javax.faces.webapp.FacesServlet.service(FacesServlet.java:266) [jsf-api-1.2_15-b01-redhat-3.jar:1.2_15-b01-redhat-3]

                            at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:295) [jbossweb-7.2.0.Final-redhat-1.jar:7.2.0.Final-redhat-1]

                            at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:214) [jbossweb-7.2.0.Final-redhat-1.jar:7.2.0.Final-redhat-1]

                            at org.ajax4jsf.webapp.BaseFilter.doFilter(BaseFilter.java:530) [richfaces-impl-3.3.3.Final.jar:3.3.3.Final]

                            at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:246) [jbossweb-7.2.0.Final-redhat-1.jar:7.2.0.Final-redhat-1]

                            at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:214) [jbossweb-7.2.0.Final-redhat-1.jar:7.2.0.Final-redhat-1]

                            at org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:83) [jboss-seam-2.2.2.Final.jar:2.2.2.Final]

                            at org.jboss.seam.web.IdentityFilter.doFilter(IdentityFilter.java:40) [jboss-seam-2.2.2.Final.jar:2.2.2.Final]

                            at org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:69) [jboss-seam-2.2.2.Final.jar:2.2.2.Final]

                            at org.jboss.seam.web.MultipartFilter.doFilter(MultipartFilter.java:90) [jboss-seam-2.2.2.Final.jar:2.2.2.Final]

                            at org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:69) [jboss-seam-2.2.2.Final.jar:2.2.2.Final]

                            at org.jboss.seam.web.ExceptionFilter.doFilter(ExceptionFilter.java:64) [jboss-seam-2.2.2.Final.jar:2.2.2.Final]

                            at org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:69) [jboss-seam-2.2.2.Final.jar:2.2.2.Final]

                            at org.jboss.seam.web.RedirectFilter.doFilter(RedirectFilter.java:45) [jboss-seam-2.2.2.Final.jar:2.2.2.Final]

                            at org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:69) [jboss-seam-2.2.2.Final.jar:2.2.2.Final]

                            at org.ajax4jsf.webapp.BaseXMLFilter.doXmlFilter(BaseXMLFilter.java:206) [richfaces-impl-3.3.3.Final.jar:3.3.3.Final]

                            at org.ajax4jsf.webapp.BaseFilter.handleRequest(BaseFilter.java:290) [richfaces-impl-3.3.3.Final.jar:3.3.3.Final]

                            at org.ajax4jsf.webapp.BaseFilter.processUploadsAndHandleRequest(BaseFilter.java:388) [richfaces-impl-3.3.3.Final.jar:3.3.3.Final]

                            at org.ajax4jsf.webapp.BaseFilter.doFilter(BaseFilter.java:515) [richfaces-impl-3.3.3.Final.jar:3.3.3.Final]

                            at org.jboss.seam.web.Ajax4jsfFilter.doFilter(Ajax4jsfFilter.java:56) [jboss-seam-2.2.2.Final.jar:2.2.2.Final]

                            at org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:69) [jboss-seam-2.2.2.Final.jar:2.2.2.Final]

                            at org.jboss.seam.web.LoggingFilter.doFilter(LoggingFilter.java:60) [jboss-seam-2.2.2.Final.jar:2.2.2.Final]

                            at org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:69) [jboss-seam-2.2.2.Final.jar:2.2.2.Final]

                            at org.jboss.seam.web.HotDeployFilter.doFilter(HotDeployFilter.java:53) [jboss-seam-2.2.2.Final.jar:2.2.2.Final]

                            at org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:69) [jboss-seam-2.2.2.Final.jar:2.2.2.Final]

                            at org.jboss.seam.servlet.SeamFilter.doFilter(SeamFilter.java:158) [jboss-seam-2.2.2.Final.jar:2.2.2.Final]

                            at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:246) [jbossweb-7.2.0.Final-redhat-1.jar:7.2.0.Final-redhat-1]

                            at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:214) [jbossweb-7.2.0.Final-redhat-1.jar:7.2.0.Final-redhat-1]

                            at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:230) [jbossweb-7.2.0.Final-redhat-1.jar:7.2.0.Final-redhat-1]

                            at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:149) [jbossweb-7.2.0.Final-redhat-1.jar:7.2.0.Final-redhat-1]

                            at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:389) [jbossweb-7.2.0.Final-redhat-1.jar:7.2.0.Final-redhat-1]

                            at org.jboss.as.web.security.SecurityContextAssociationValve.invoke(SecurityContextAssociationValve.java:169) [jboss-as-web-7.2.0.Final-redhat-8.jar:7.2.0.Final-redhat-8]

                            at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:145) [jbossweb-7.2.0.Final-redhat-1.jar:7.2.0.Final-redhat-1]

                            at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:97) [jbossweb-7.2.0.Final-redhat-1.jar:7.2.0.Final-redhat-1]

                            at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:102) [jbossweb-7.2.0.Final-redhat-1.jar:7.2.0.Final-redhat-1]

                            at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:336) [jbossweb-7.2.0.Final-redhat-1.jar:7.2.0.Final-redhat-1]

                            at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:856) [jbossweb-7.2.0.Final-redhat-1.jar:7.2.0.Final-redhat-1]

                            at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:653) [jbossweb-7.2.0.Final-redhat-1.jar:7.2.0.Final-redhat-1]

                            at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:920) [jbossweb-7.2.0.Final-redhat-1.jar:7.2.0.Final-redhat-1]

                            at java.lang.Thread.run(Thread.java:724) [rt.jar:1.7.0_25]

                        • 9. Re: JBoss7: java.lang.InstantiationException: org.jboss.as.weld.webtier.jsf.WeldApplicationFactory
                          rchilla0601

                          Hi even after changing the module.xml in weld and weld core to use jsf-apito use slot 1.2 I am getting the same error, could you please helpme out

                          • 10. Re: JBoss7: java.lang.InstantiationException: org.jboss.as.weld.webtier.jsf.WeldApplicationFactory
                            rchilla0601

                            Done the same but still getting the same error