2 Replies Latest reply on Jul 10, 2013 4:33 PM by Georgi Gyurchev

    JBoss AS 7.0.2 and JSF migration

    Georgi Gyurchev Newbie

      Hi all,

       

      I'm currently given the taks to do some upgrades. We are using JBoss AS 7.0.2, Seam 2.2.2, JSF 1.2 and Richfaces 3 and the goal is to migrate to Seam 2.3.0, JSF 2.x and Richfaces 4.

       

      Unfortunately, Seam and JSF have to be done at the same time. I think I'm currently having a problem with JBoss and JSF. What I did so far is change the jar files inside the project and did some configuration changes according to the seam migration guide http://docs.jboss.org/seam/2.3.0.Final/reference/en-US/html/migration23.html

      Then, the server was starting but if I tried to load a page, it gives only 500 Internal Server Error and an exception about a missing method in JSF. So I found out that the JSF used within JBoss is still 1.2 and did some changes in the jboss-deployment-structure.xml that previously included dependencies on jsf 1.2 and exclusions of the main slot. It now looks like this:

       

      <jboss-deployment-structure xmlns="urn:jboss:deployment-structure:1.0">
      
        <deployment>
          <exclusions>
                 <module name="javax.faces.api" slot="1.2"/>
              <module name="com.sun.jsf-impl" slot="1.2"/>
          </exclusions>
          <dependencies>
              <module name="org.dom4j" export="true"/>
              <module name="org.apache.commons.collections" export="true"/>
                 <module name="org.codehaus.jackson.jackson-core-asl" export="true" slot="main"/>
                 <module name="org.codehaus.jackson.jackson-mapper-asl" export="true" slot="main"/>
                 <module name="javax.faces.api" export="true" slot="main"/>
              <module name="com.sun.jsf-impl" export="true" slot="main"/>
                 <module name="org.jboss.as.jpa.spi" export="true"/>
                 <module name="org.antlr" export="true"/>
                 <module name="org.slf4j" export="false"/>
                 <module name="org.jboss.common-core" export="true"/>
          </dependencies>
        </deployment>
      
        <sub-deployment name="*name*-ejb.jar">
           <dependencies>
               <!--  need this since the war file has its own classloader and the jar can otherwise not see classes within the war, such as the messages properties -->
                <module name="deployment.infonds3.ear.infonds3-web.war" />
           </dependencies>
        </sub-deployment>
        <sub-deployment name="*name*-web.war">
            <exclusions>
              <module name="javax.faces.api" slot="1.2"/>
              <module name="com.sun.jsf-impl" slot="1.2"/>
            </exclusions>
            <dependencies>
              <module name="javax.faces.api" slot="main"/>
              <module name="com.sun.jsf-impl" slot="main"/>
            </dependencies>
        </sub-deployment>
      </jboss-deployment-structure>
      

       

      But now I get the following exceptions when I start the server:

       

      11:57:40,022 SCHWERWIEGEND [javax.enterprise.resource.webcontainer.jsf.config] (MSC service thread 1-5) Critical error during deployment: : com.sun.faces.config.ConfigurationException: CONFIGURATION FAILED! Must have a Constructor that takes in a ComponentConfig
          at com.sun.faces.config.ConfigManager.initialize(ConfigManager.java:376) [jsf-impl-2.1.3-b02-jbossorg-2.jar:2.1.3-SNAPSHOT]
          at com.sun.faces.config.ConfigureListener.contextInitialized(ConfigureListener.java:225) [jsf-impl-2.1.3-b02-jbossorg-2.jar:2.1.3-SNAPSHOT]
          at org.apache.catalina.core.StandardContext.contextListenerStart(StandardContext.java:3368) [jbossweb-7.0.1.Final.jar:7.0.2.Final]
          at org.apache.catalina.core.StandardContext.start(StandardContext.java:3821) [jbossweb-7.0.1.Final.jar:7.0.2.Final]
          at org.jboss.as.web.deployment.WebDeploymentService.start(WebDeploymentService.java:70) [jboss-as-web-7.0.2.Final.jar:7.0.2.Final]
          at org.jboss.msc.service.ServiceControllerImpl$StartTask.startService(ServiceControllerImpl.java:1824)
          at org.jboss.msc.service.ServiceControllerImpl$StartTask.run(ServiceControllerImpl.java:1759)
          at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:895) [:1.6.0_43]
          at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:918) [:1.6.0_43]
          at java.lang.Thread.run(Thread.java:662) [:1.6.0_43]
      Caused by: javax.faces.view.facelets.FaceletException: Must have a Constructor that takes in a ComponentConfig
          at com.sun.faces.facelets.tag.AbstractTagLibrary$UserComponentHandlerFactory.<init>(AbstractTagLibrary.java:295) [jsf-impl-2.1.3-b02-jbossorg-2.jar:2.1.3-SNAPSHOT]
          at com.sun.faces.facelets.tag.AbstractTagLibrary.addComponent(AbstractTagLibrary.java:525) [jsf-impl-2.1.3-b02-jbossorg-2.jar:2.1.3-SNAPSHOT]
          at com.sun.faces.facelets.tag.TagLibraryImpl.putComponent(TagLibraryImpl.java:115) [jsf-impl-2.1.3-b02-jbossorg-2.jar:2.1.3-SNAPSHOT]
          at com.sun.faces.config.processor.FaceletTaglibConfigProcessor.processComponent(FaceletTaglibConfigProcessor.java:569) [jsf-impl-2.1.3-b02-jbossorg-2.jar:2.1.3-SNAPSHOT]
          at com.sun.faces.config.processor.FaceletTaglibConfigProcessor.processTags(FaceletTaglibConfigProcessor.java:361) [jsf-impl-2.1.3-b02-jbossorg-2.jar:2.1.3-SNAPSHOT]
          at com.sun.faces.config.processor.FaceletTaglibConfigProcessor.processTagLibrary(FaceletTaglibConfigProcessor.java:314) [jsf-impl-2.1.3-b02-jbossorg-2.jar:2.1.3-SNAPSHOT]
          at com.sun.faces.config.processor.FaceletTaglibConfigProcessor.process(FaceletTaglibConfigProcessor.java:263) [jsf-impl-2.1.3-b02-jbossorg-2.jar:2.1.3-SNAPSHOT]
          at com.sun.faces.config.ConfigManager.initialize(ConfigManager.java:363) [jsf-impl-2.1.3-b02-jbossorg-2.jar:2.1.3-SNAPSHOT]
          ... 9 more
      Caused by: java.lang.NoSuchMethodException: ****company_package****.pdf.PdfComponentHandler.<init>(javax.faces.view.facelets.ComponentConfig)
          at java.lang.Class.getConstructor0(Class.java:2715) [:1.6.0_43]
          at java.lang.Class.getConstructor(Class.java:1659) [:1.6.0_43]
          at com.sun.faces.facelets.tag.AbstractTagLibrary$UserComponentHandlerFactory.<init>(AbstractTagLibrary.java:293) [jsf-impl-2.1.3-b02-jbossorg-2.jar:2.1.3-SNAPSHOT]
          ... 16 more
      
      11:57:40,024 ERROR [org.apache.catalina.core.ContainerBase.[jboss.web].[default-host].[/productName]] (MSC service thread 1-5) Exception sending context initialized event to listener instance of class com.sun.faces.config.ConfigureListener: java.lang.RuntimeException: com.sun.faces.config.ConfigurationException: CONFIGURATION FAILED! Must have a Constructor that takes in a ComponentConfig
          at com.sun.faces.config.ConfigureListener.contextInitialized(ConfigureListener.java:292) [jsf-impl-2.1.3-b02-jbossorg-2.jar:2.1.3-SNAPSHOT]
          at org.apache.catalina.core.StandardContext.contextListenerStart(StandardContext.java:3368) [jbossweb-7.0.1.Final.jar:7.0.2.Final]
          at org.apache.catalina.core.StandardContext.start(StandardContext.java:3821) [jbossweb-7.0.1.Final.jar:7.0.2.Final]
          at org.jboss.as.web.deployment.WebDeploymentService.start(WebDeploymentService.java:70) [jboss-as-web-7.0.2.Final.jar:7.0.2.Final]
          at org.jboss.msc.service.ServiceControllerImpl$StartTask.startService(ServiceControllerImpl.java:1824)
          at org.jboss.msc.service.ServiceControllerImpl$StartTask.run(ServiceControllerImpl.java:1759)
          at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:895) [:1.6.0_43]
          at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:918) [:1.6.0_43]
          at java.lang.Thread.run(Thread.java:662) [:1.6.0_43]
      Caused by: com.sun.faces.config.ConfigurationException: CONFIGURATION FAILED! Must have a Constructor that takes in a ComponentConfig
          at com.sun.faces.config.ConfigManager.initialize(ConfigManager.java:376) [jsf-impl-2.1.3-b02-jbossorg-2.jar:2.1.3-SNAPSHOT]
          at com.sun.faces.config.ConfigureListener.contextInitialized(ConfigureListener.java:225) [jsf-impl-2.1.3-b02-jbossorg-2.jar:2.1.3-SNAPSHOT]
          ... 8 more
      Caused by: javax.faces.view.facelets.FaceletException: Must have a Constructor that takes in a ComponentConfig
          at com.sun.faces.facelets.tag.AbstractTagLibrary$UserComponentHandlerFactory.<init>(AbstractTagLibrary.java:295) [jsf-impl-2.1.3-b02-jbossorg-2.jar:2.1.3-SNAPSHOT]
          at com.sun.faces.facelets.tag.AbstractTagLibrary.addComponent(AbstractTagLibrary.java:525) [jsf-impl-2.1.3-b02-jbossorg-2.jar:2.1.3-SNAPSHOT]
          at com.sun.faces.facelets.tag.TagLibraryImpl.putComponent(TagLibraryImpl.java:115) [jsf-impl-2.1.3-b02-jbossorg-2.jar:2.1.3-SNAPSHOT]
          at com.sun.faces.config.processor.FaceletTaglibConfigProcessor.processComponent(FaceletTaglibConfigProcessor.java:569) [jsf-impl-2.1.3-b02-jbossorg-2.jar:2.1.3-SNAPSHOT]
          at com.sun.faces.config.processor.FaceletTaglibConfigProcessor.processTags(FaceletTaglibConfigProcessor.java:361) [jsf-impl-2.1.3-b02-jbossorg-2.jar:2.1.3-SNAPSHOT]
          at com.sun.faces.config.processor.FaceletTaglibConfigProcessor.processTagLibrary(FaceletTaglibConfigProcessor.java:314) [jsf-impl-2.1.3-b02-jbossorg-2.jar:2.1.3-SNAPSHOT]
          at com.sun.faces.config.processor.FaceletTaglibConfigProcessor.process(FaceletTaglibConfigProcessor.java:263) [jsf-impl-2.1.3-b02-jbossorg-2.jar:2.1.3-SNAPSHOT]
          at com.sun.faces.config.ConfigManager.initialize(ConfigManager.java:363) [jsf-impl-2.1.3-b02-jbossorg-2.jar:2.1.3-SNAPSHOT]
          ... 9 more
      Caused by: java.lang.NoSuchMethodException: ****company_package****.pdf.PdfComponentHandler.<init>(javax.faces.view.facelets.ComponentConfig)
          at java.lang.Class.getConstructor0(Class.java:2715) [:1.6.0_43]
          at java.lang.Class.getConstructor(Class.java:1659) [:1.6.0_43]
          at com.sun.faces.facelets.tag.AbstractTagLibrary$UserComponentHandlerFactory.<init>(AbstractTagLibrary.java:293) [jsf-impl-2.1.3-b02-jbossorg-2.jar:2.1.3-SNAPSHOT]
          ... 16 more
      
      11:57:40,025 ERROR [org.apache.catalina.core.StandardContext] (MSC service thread 1-5) Error listenerStart
      11:57:40,025 ERROR [org.apache.catalina.core.StandardContext] (MSC service thread 1-5) Context [/productName] startup failed due to previous errors
      11:57:40,027 SCHWERWIEGEND [javax.enterprise.resource.webcontainer.jsf.config] (MSC service thread 1-5) Unexpected exception when attempting to tear down the Mojarra runtime: java.lang.IllegalStateException: Die Anwendung wurde bei Systemstart nicht einwandfrei initialisiert, Factory konnte nicht gefunden werden: javax.faces.application.ApplicationFactory
          at javax.faces.FactoryFinder$FactoryManager.getFactory(FactoryFinder.java:957) [jboss-jsf-api_2.1_spec-2.0.0.Beta1.jar:2.0.0.Beta1]
          at javax.faces.FactoryFinder.getFactory(FactoryFinder.java:316) [jboss-jsf-api_2.1_spec-2.0.0.Beta1.jar:2.0.0.Beta1]
          at com.sun.faces.config.InitFacesContext.getApplication(InitFacesContext.java:126) [jsf-impl-2.1.3-b02-jbossorg-2.jar:2.1.3-SNAPSHOT]
          at com.sun.faces.config.ConfigureListener.contextDestroyed(ConfigureListener.java:328) [jsf-impl-2.1.3-b02-jbossorg-2.jar:2.1.3-SNAPSHOT]
          at org.apache.catalina.core.StandardContext.listenerStop(StandardContext.java:3465) [jbossweb-7.0.1.Final.jar:7.0.2.Final]
          at org.apache.catalina.core.StandardContext.stop(StandardContext.java:3970) [jbossweb-7.0.1.Final.jar:7.0.2.Final]
          at org.apache.catalina.core.StandardContext.start(StandardContext.java:3888) [jbossweb-7.0.1.Final.jar:7.0.2.Final]
          at org.jboss.as.web.deployment.WebDeploymentService.start(WebDeploymentService.java:70) [jboss-as-web-7.0.2.Final.jar:7.0.2.Final]
          at org.jboss.msc.service.ServiceControllerImpl$StartTask.startService(ServiceControllerImpl.java:1824)
          at org.jboss.msc.service.ServiceControllerImpl$StartTask.run(ServiceControllerImpl.java:1759)
          at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:895) [:1.6.0_43]
          at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:918) [:1.6.0_43]
          at java.lang.Thread.run(Thread.java:662) [:1.6.0_43]
      

       

      Does anyone know where the problem is? I've tried what not - different jar files, putting the same ones from the jboss jsf module in the project, changing the deployment structure in various ways, adding some stuff to web.xml I found while searching for the solution:

       

      <context-param>
            <param-name>org.ajax4jsf.VIEW_HANDLERS</param-name>
            <param-value>com.sun.facelets.FaceletViewHandler</param-value>
        </context-param>
        
        <context-param>
            <param-name>org.jboss.jbossfaces.WAR_BUNDLES_JSF_IMPL</param-name>
            <param-value>true</param-value>
      </context-param>
      

       

      PS: I've deleted the name of the company/product from the code/output as I'm not sure what I'm allowed to share here.

        • 1. Re: JBoss AS 7.0.2 and JSF migration
          Stan Silvert Master

          If I'm not mistaken, Seam 2 is not compatible with JSF 2.x.

           

          As 7.0.2 uses JSF 2.0 by default.  If you want to use the JSF 1.2 implementation built into AS 7.0.2, you need to specify this in your web.xml:

            <context-param>
                <param-name>org.jboss.jbossfaces.JSF_CONFIG_NAME</param-name>
                <param-value>Mojarra-1.2</param-value>
            </context-param>
          

           

          Don't ever use jboss-deployment-structure.xml for configuring JSF.  Avoid WAR_BUNDLES_JSF_IMPL if possible.

           

          Stan

          • 2. Re: JBoss AS 7.0.2 and JSF migration
            Georgi Gyurchev Newbie

            I think we found the problem.

             

            @Stan Silvert

            Seam 2.3 not only supports JSF 2 but unfortunately also requires it, forcing us to migrate everything at the same time.

             

            It was conflicting with the facelets somehow. Richfaces 3.3.3 works with jsf 2 but doesn't fully support it, so it needs also the facelets jar separately and that's why we left it there. I think some of our classes made it impossible to keep both jsf 2 and the facelets.

             

            So in the end everything has to be done at the same time - directly switch to richfaces 4, jsf 2 and seam 2.3 or higher.

             

            The server now starts without exceptions but of course, it's a long way until actual pages can be loaded.

             

            I hope this is helpful to anyone having this problem in the future.