1 Reply Latest reply on Jan 20, 2011 1:19 PM by Stan Silvert

    Using JSF impl from JBoss 4.2.2.GA in 5.1.0.GA

    Anthony O. Newbie

      Hi,

       

      I'm trying to migrate a Seam 2.2.0.GA application from JBoss 4.2.2.GA to 5.1.0.GA.

      The problem is that in 5.1.0.GA, the application has strange behaviors with JSF.

       

      I've seen that in 4.2.2.GA, jsf-impl is version 1.2_04-p02 and in 5.1.0.GA it's version 1.2_12.

      So I'm trying to use specific 1.2_04-p02 of jsf-libs into my war (the application is bundled in an ear).

       

      I've googled for a long time then I found that my solution could be to add

      {code:xml}

      <context-param>

        <param-name>org.jboss.jbossfaces.WAR_BUNDLES_JSF_IMPL</param-name>

        <param-value>true</param-value>

      </context-param>

      {code}

       

      in web.xml and bundle the jsf-impl-1.2_04-p02.jar in the war (so in WEB-INF/lib).

       

      After that, and even if I added the jsf-impl.jar in /lib of the ear, I had that Exception :

      {code}

      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:725)

      {code}

      (Full stack here : [http://www.copypastecode.com/62278/])

       

      Same Exception if I put the 3 jars in WEB-INF/jsf-libs, and this with or without WEB-INF/jboss-web.xml

      {code:xml}

          <class-loading java2ClassLoadingCompliance="false">

              <loader-repository>

                  seam.jboss.org:loader=myWebapp

                  <loader-repository-config>java2ParentDelegation=false</loader-repository-config>

              </loader-repository>

          </class-loading>

      {code}

       

       

      I also tried to replace directly the jars of deploy/jboss-web.deployer/jsf-libs with those found in 4.2.2.GA, but then I had an error when starting JBoss :

      {code}

      15:51:15,907 FATAL [application] JSF1030: The specified InjectionProvider implementation 'org.jboss.web.jsf.integration.injection.JBossDelegatingInjectionProvider' cannot be loaded.

      15:51:15,908 INFO  [application] JSF1048: PostConstruct/PreDestroy annotations present.  ManagedBeans methods marked with these annotations will have said annotations processed.

      {code}

       

      I once managed to have that other Exception instead, but I don't remember how :

      {code}

      com.sun.faces.config.ConfigurationException: CONFIGURATION FAILED! com.sun.faces.config.WebConfiguration cannot be cast to com.sun.faces.config.WebConfiguration

                at com.sun.faces.config.ConfigManager.initialize(ConfigManager.java:213)

      {code}

      (Full stack here : [http://www.copypastecode.com/62278/http://www.copypastecode.com/62282/])

       

      Is there a mean to do that ?

       

      Thanks !

        • 1. Re: Using JSF impl from JBoss 4.2.2.GA in 5.1.0.GA
          Stan Silvert Master

          For AS5, WAR_BUNDLES_JSF_IMPL is only for bundling MyFaces.  In AS6, you can set up different JSF configurations or you can use WAR_BUNDLES_JSF_IMPL to bundle any JSF impl with your WAR.

           

          As long as you are sticking with Mojarra 1.2, I'd change the version in JBoss rather than trying to use WAR_BUNDLES_JSF_IMPL.  Stay down the path of replacing the jars in deploy/jboss-web.sar/jsf-libs.  Make sure you rename them to jsf-api.jar and jsf-impl.jar.  I don't have a copy of AS4 handy so I'm going from memory here, but you should look at the "global" web.xml found in the jbossweb.sar.  It specifies an implementation of the injection provider that you will use with the older JSF.   You are looking for the AS4 version of this param found in deployers\jbossweb.deployer\web.xml:

             <!-- JBossInjectionProvider provides resource injection for managed beans. -->
             <!-- See JSF 1.2 spec section 5.4 for details.                             -->
             <context-param>
               <param-name>com.sun.faces.injectionProvider</param-name>
               <param-value>org.jboss.web.jsf.integration.injection.JBossDelegatingInjectionProvider</param-value>
             </context-param>
          

          I think we used a different implementaiton in AS4 and it should still be there to use in AS5.

           

          Or, if you don't use resource injection on your managed beans you can just comment that part out and the FATAL error will go away.

           

          Stan