5 Replies Latest reply on Dec 13, 2018 9:56 AM by jpari1982

    Wildfly and MyFaces 2.2 problem

    chrkoelle

      Hi

       

      We want to use Myfaces 2.2 in Wildfly 8.0.0.Final. I followed the instructions on Steps to add any new JSF implementation or version to WildFly and everything seems to be fine. But if i deploy our web application i get the following stack trace:

       

      10:35:38,810 INFO  [org.apache.myfaces.spi.impl.DefaultInjectionProviderFactory] (MSC service thread 1-5) Using InjectionProvider org.apache.myfaces.spi.impl.Tomcat7AnnotationInjectionProvider

      10:35:38,811 SEVERE [org.apache.myfaces.webapp.AbstractFacesInitializer] (MSC service thread 1-5) An error occured while initializing MyFaces: java.lang.reflect.InvocationTargetException: javax.faces.FacesException: java.lang.reflect.InvocationTargetException

        at javax.faces.FactoryFinder.injectAndPostConstruct(FactoryFinder.java:420) [myfaces-api-2.2.2.jar:2.2.2]

        at javax.faces.FactoryFinder.newFactoryInstance(FactoryFinder.java:519) [myfaces-api-2.2.2.jar:2.2.2]

        at javax.faces.FactoryFinder._getFactory(FactoryFinder.java:361) [myfaces-api-2.2.2.jar:2.2.2]

        at javax.faces.FactoryFinder.getFactory(FactoryFinder.java:225) [myfaces-api-2.2.2.jar:2.2.2]

        at org.apache.myfaces.application.ViewHandlerImpl.<init>(ViewHandlerImpl.java:90) [myfaces-impl-2.2.2.jar:2.2.2]

        at org.apache.myfaces.application.ApplicationImpl.<init>(ApplicationImpl.java:271) [myfaces-impl-2.2.2.jar:2.2.2]

        at org.apache.myfaces.application.ApplicationImpl.<init>(ApplicationImpl.java:254) [myfaces-impl-2.2.2.jar:2.2.2]

        at org.apache.myfaces.application.ApplicationFactoryImpl.createAndLogNewApplication(ApplicationFactoryImpl.java:55) [myfaces-impl-2.2.2.jar:2.2.2]

        at org.apache.myfaces.application.ApplicationFactoryImpl.<init>(ApplicationFactoryImpl.java:50) [myfaces-impl-2.2.2.jar:2.2.2]

        at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method) [rt.jar:1.7.0_51]

        at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:57) [rt.jar:1.7.0_51]

        at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45) [rt.jar:1.7.0_51]

        at java.lang.reflect.Constructor.newInstance(Constructor.java:526) [rt.jar:1.7.0_51]

        at java.lang.Class.newInstance(Class.java:374) [rt.jar:1.7.0_51]

        at javax.faces.FactoryFinder.newFactoryInstance(FactoryFinder.java:518) [myfaces-api-2.2.2.jar:2.2.2]

        at javax.faces.FactoryFinder._getFactory(FactoryFinder.java:361) [myfaces-api-2.2.2.jar:2.2.2]

        at javax.faces.FactoryFinder.getFactory(FactoryFinder.java:225) [myfaces-api-2.2.2.jar:2.2.2]

        at org.apache.myfaces.config.FacesConfigurator.configureApplication(FacesConfigurator.java:577) [myfaces-impl-2.2.2.jar:2.2.2]

        at org.apache.myfaces.config.FacesConfigurator.configure(FacesConfigurator.java:477) [myfaces-impl-2.2.2.jar:2.2.2]

        at org.apache.myfaces.webapp.AbstractFacesInitializer.buildConfiguration(AbstractFacesInitializer.java:416) [myfaces-impl-2.2.2.jar:2.2.2]

        at org.apache.myfaces.webapp.Jsp21FacesInitializer.initContainerIntegration(Jsp21FacesInitializer.java:73) [myfaces-impl-2.2.2.jar:2.2.2]

        at org.apache.myfaces.webapp.AbstractFacesInitializer.initFaces(AbstractFacesInitializer.java:172) [myfaces-impl-2.2.2.jar:2.2.2]

        at org.apache.myfaces.webapp.StartupServletContextListener.contextInitialized(StartupServletContextListener.java:119) [myfaces-impl-2.2.2.jar:2.2.2]

        at io.undertow.servlet.core.ApplicationListeners.contextInitialized(ApplicationListeners.java:173) [undertow-servlet-1.0.0.Final.jar:1.0.0.Final]

        at io.undertow.servlet.core.DeploymentManagerImpl.deploy(DeploymentManagerImpl.java:187) [undertow-servlet-1.0.0.Final.jar:1.0.0.Final]

        at org.wildfly.extension.undertow.deployment.UndertowDeploymentService.startContext(UndertowDeploymentService.java:86)

        at org.wildfly.extension.undertow.deployment.UndertowDeploymentService.start(UndertowDeploymentService.java:71)

        at org.jboss.msc.service.ServiceControllerImpl$StartTask.startService(ServiceControllerImpl.java:1948)

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

        at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145) [rt.jar:1.7.0_51]

        at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615) [rt.jar:1.7.0_51]

        at java.lang.Thread.run(Thread.java:744) [rt.jar:1.7.0_51]

      Caused by: java.lang.reflect.InvocationTargetException

        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) [rt.jar:1.7.0_51]

        at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57) [rt.jar:1.7.0_51]

        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) [rt.jar:1.7.0_51]

        at java.lang.reflect.Method.invoke(Method.java:606) [rt.jar:1.7.0_51]

        at javax.faces.FactoryFinder.injectAndPostConstruct(FactoryFinder.java:415) [myfaces-api-2.2.2.jar:2.2.2]

        ... 31 more

      Caused by: java.lang.NoClassDefFoundError: org/apache/tomcat/InstanceManager

        at org.apache.myfaces.spi.impl.Tomcat7AnnotationInjectionProvider.initManager(Tomcat7AnnotationInjectionProvider.java:182) [myfaces-impl-2.2.2.jar:2.2.2]

        at org.apache.myfaces.spi.impl.Tomcat7AnnotationInjectionProvider.postConstruct(Tomcat7AnnotationInjectionProvider.java:85) [myfaces-impl-2.2.2.jar:2.2.2]

        ... 36 more

       

      Of course the Tomcat InstanceManager is not available. I think that the use of the Tomcat7AnnotationInjectionProvider is not correct. The use of CDIAnnotationDelegateInjectionProvider would be correct. But i don't find any hint how to change this.

       

      Christian

        • 1. Re: Wildfly and MyFaces 2.2 problem
          frer

          Hey,

           

          Have you found an answer to your question (I know its been almost a year)?  We are encountering the exact same issue.

           

          Thanks,

          • 2. Re: Wildfly and MyFaces 2.2 problem
            atulajoshi24

            Hi,

            I am also facing the same issue. Has anybody found any solution for this ?

             

            Regards,

            Atul

            • 3. Re: Wildfly and MyFaces 2.2 problem
              ashwani.godara

              This issue seems to go away when you add tomcat-api.x.x.jar , the required file is in this JAR. But his didnt solve problem for us. Now we are facing

               

              Caused by: java.lang.ClassCastException: org.wildfly.extension.undertow.deployment.UndertowJSPInstanceManager cannot be cast to org.apache.tomcat.InstanceManager

              at org.apache.myfaces.spi.impl.Tomcat7AnnotationInjectionProvider.initManager(Tomcat7AnnotationInjectionProvider.java:182)

              at org.apache.myfaces.spi.impl.Tomcat7AnnotationInjectionProvider.postConstruct(Tomcat7AnnotationInjectionProvider.java:85)

              ... 37 more

               

              Does any one have solution for this, seems like a class loading issue

              • 4. Re: Wildfly and MyFaces 2.2 problem
                masummymesingh

                are you any issue other jsf impl.jar file ?

                • 5. Re: Wildfly and MyFaces 2.2 problem
                  jpari1982

                  is this issue resolved? We are facing the same problem with myfaces 2.2.3 in jboss eap 7

                   

                  While deploying application with myfaces 2.2.3 in Jboss eap 7, we are seeing below exception

                   

                  2018-12-12T10:39:20,712 zep516Crhh5D5VrmIIQtHpkd9JTocyyLpNvlecWM [default task-2] CustomExceptionHandler.handle [Exception caught in CustomExceptionHandler :: StackTrace :: ] java.lang.NoClassDefFoundError: org/apache/tomcat/InstanceManager at org.apache.myfaces.config.annotation.Tomcat7AnnotationLifecycleProvider.initManager(Tomcat7AnnotationLifecycleProvider.java:136) ~[myfaces-impl-2.2.3.jar:2.2.3]

                   

                  To over come this, included tomcat-api-8*.jar as recommened in (https://access.redhat.com/solutions/2787331). This helped to resolve NoClassDefFoundError, now we are getting classcast exception

                   

                  org.wildfly.extension.undertow.deployment.UndertowJSPInstanceManager cannot be cast to org.apache.tomcat.InstanceManager Please help