1 2 3 Previous Next 37 Replies Latest reply on Jun 24, 2013 11:42 AM by ssilvert

    Using another JSF implementation in JBoss AS 7.0.1

    gastaldi

      Hello !

       

      I am trying to bundle a different JSF implementation in AS 7.0.1. I tried using the org.jboss.jbossfaces.WAR_BUNDLES_JSF_IMPL context param, but it didn´t work very well. The following stack trace is shown if I try to load MyFaces 2.0.7, with this param enabled:

       

       

      18:16:13,323 GRAVE [org.apache.myfaces.webapp.AbstractFacesInitializer] (MSC service thread 1-7) An error occured while initializing MyFaces: Class org.jboss.as.weld.webtier.jsf.WeldApplicationFactory is no javax.faces.application.ApplicationFactory: java.lang.IllegalArgumentException: Class org.jboss.as.weld.webtier.jsf.WeldApplicationFactory is no javax.faces.application.ApplicationFactory
                at javax.faces.FactoryFinder.newFactoryInstance(FactoryFinder.java:307) [myfaces-api-2.0.7.jar:]
                at javax.faces.FactoryFinder._getFactory(FactoryFinder.java:273) [myfaces-api-2.0.7.jar:]
                at javax.faces.FactoryFinder.getFactory(FactoryFinder.java:191) [myfaces-api-2.0.7.jar:]
                at org.apache.myfaces.config.FacesConfigurator.configureApplication(FacesConfigurator.java:484) [myfaces-impl-2.0.7.jar:]
                at org.apache.myfaces.config.FacesConfigurator.configure(FacesConfigurator.java:398) [myfaces-impl-2.0.7.jar:]
                at org.apache.myfaces.webapp.AbstractFacesInitializer.buildConfiguration(AbstractFacesInitializer.java:309) [myfaces-impl-2.0.7.jar:]
                at org.apache.myfaces.webapp.Jsp21FacesInitializer.initContainerIntegration(Jsp21FacesInitializer.java:73) [myfaces-impl-2.0.7.jar:]
                at org.apache.myfaces.webapp.AbstractFacesInitializer.initFaces(AbstractFacesInitializer.java:125) [myfaces-impl-2.0.7.jar:]
                at org.apache.myfaces.webapp.StartupServletContextListener.contextInitialized(StartupServletContextListener.java:111) [myfaces-impl-2.0.7.jar:]
                at org.apache.catalina.core.StandardContext.contextListenerStart(StandardContext.java:3368) [jbossweb-7.0.1.Final.jar:7.0.1.Final]
                at org.apache.catalina.core.StandardContext.start(StandardContext.java:3821) [jbossweb-7.0.1.Final.jar:7.0.1.Final]
                at org.jboss.as.web.deployment.WebDeploymentService.start(WebDeploymentService.java:70) [jboss-as-web-7.0.1.Final.jar:7.0.1.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_24]
                at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908) [:1.6.0_24]
                at java.lang.Thread.run(Thread.java:662) [:1.6.0_24]
      

       

      If I add Dependencies: javax.faces.api to my MANIFEST.MF, I get:

       

       

      18:22:36,105 ERROR [org.apache.catalina.core.ContainerBase.[jboss.web].[default-host].[/exemplo]] (MSC service thread 1-6) Exception sending context initialized event to listener instance of class org.apache.myfaces.webapp.StartupServletContextListener: java.lang.IllegalStateException: O aplicativo não foi iniciado corretamente na inicialização. Não foi possível encontrar Fábrica: javax.faces.application.ApplicationFactory
                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 org.apache.myfaces.context.servlet.FacesContextImplBase.getApplication(FacesContextImplBase.java:131) [myfaces-impl-2.0.7.jar:]
                at org.apache.myfaces.context.servlet.FacesContextImplBase.getELContext(FacesContextImplBase.java:180) [myfaces-impl-2.0.7.jar:]
                at javax.faces.component.UIViewRoot.setLocale(UIViewRoot.java:1456) [jboss-jsf-api_2.0_spec-1.0.0.Final.jar:1.0.0.Final]
                at org.apache.myfaces.webapp.AbstractFacesInitializer._createFacesContext(AbstractFacesInitializer.java:404) [myfaces-impl-2.0.7.jar:]
                at org.apache.myfaces.webapp.AbstractFacesInitializer.initStartupFacesContext(AbstractFacesInitializer.java:376) [myfaces-impl-2.0.7.jar:]
                at org.apache.myfaces.webapp.StartupServletContextListener.contextInitialized(StartupServletContextListener.java:105) [myfaces-impl-2.0.7.jar:]
                at org.apache.catalina.core.StandardContext.contextListenerStart(StandardContext.java:3368) [jbossweb-7.0.1.Final.jar:7.0.1.Final]
                at org.apache.catalina.core.StandardContext.start(StandardContext.java:3821) [jbossweb-7.0.1.Final.jar:7.0.1.Final]
                at org.jboss.as.web.deployment.WebDeploymentService.start(WebDeploymentService.java:70) [jboss-as-web-7.0.1.Final.jar:7.0.1.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_24]
                at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908) [:1.6.0_24]
                at java.lang.Thread.run(Thread.java:662) [:1.6.0_24]
      
      

       

      Is this parameter supposed to work on 7.0.1 ? Any help appreciated.

       

      Regards,

       

      George Gastaldi

        • 1. Re: Using another JSF implementation in JBoss AS 7.0.1
          ssilvert

          Yes, starting with AS 7.0.1, WAR_BUNDLES_JSF_IMPL does work.  However, as in past AS versions, you are on your own for configuring annotation scanning and other JEE features that integrate JSF with the app server.

           

          Since 7.0.1 is the first version of AS7 to include the WAR_BUNDLES_JSF_IMPL feature, I expect that there will be some rough spots in learning how to make everything work.

           

          To give you something to start with, I'm attaching a simple Hello World application that uses WAR_BUNDLES_JSF_IMPL with MyFaces 2.1.  Just build with Maven.

           

          Stan

          • 2. Re: Using another JSF implementation in JBoss AS 7.0.1
            gastaldi

            Yes, that application works. I figured it out that the error is caused by adding the following dependency to my pom.xml:

             

             

            <dependency>
                      <groupId>org.jboss.seam.persistence</groupId>
                      <artifactId>seam-persistence</artifactId>
                      <version>3.0.0.Final</version>
            </dependency>
            

             

            If I remove that, the application runs fine.

            • 3. Re: Using another JSF implementation in JBoss AS 7.0.1
              gastaldi

              It looks like an issue with CDI x JSF (other versions). If I add a beans.xml to this project (a empty one), the same error is reproduced. I filed a bug under AS7-1628

              • 4. Re: Using another JSF implementation in JBoss AS 7.0.1
                bcn

                Hello,

                 

                I tried with Mojarra 2.1.2 and get the following error:

                 

                09:11:05,408 SEVERE [javax.enterprise.resource.webcontainer.jsf.application] (MSC service thread 1-11) JSF1051: Service entry 'org.jboss.as.web.deployment.jsf.JsfInjectionProvider' does not extend DiscoverableInjectionProvider.  Entry will be ignored.

                09:11:05,409 INFO  [javax.enterprise.resource.webcontainer.jsf.application] (MSC service thread 1-11) JSF1048: PostConstruct/PreDestroy annotations present.  ManagedBeans methods marked with these annotations will have said annotations processed.

                09:11:05,420 SEVERE [javax.enterprise.resource.webcontainer.jsf.config] (MSC service thread 1-11) Critical error during deployment: : com.sun.faces.config.ConfigurationException: CONFIGURATION FAILED! Class org.jboss.as.web.deployment.jsf.JandexAnnotationProvider is not an instance of com.sun.faces.spi.AnnotationProvider

                    at com.sun.faces.config.ConfigManager.initialize(ConfigManager.java:375) [jsf-impl.jar:]

                    at com.sun.faces.config.ConfigureListener.contextInitialized(ConfigureListener.java:225) [jsf-impl.jar:]

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

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

                    at org.jboss.as.web.deployment.WebDeploymentService.start(WebDeploymentService.java:70) [jboss-as-web-7.0.1.Final.jar:7.0.1.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_24]

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

                    at java.lang.Thread.run(Thread.java:662) [:1.6.0_24]

                Caused by: javax.faces.FacesException: Class org.jboss.as.web.deployment.jsf.JandexAnnotationProvider is not an instance of com.sun.faces.spi.AnnotationProvider

                    at com.sun.faces.spi.AnnotationProviderFactory.createAnnotationProvider(AnnotationProviderFactory.java:78) [jsf-impl.jar:]

                    at com.sun.faces.config.ConfigManager$AnnotationScanTask.<init>(ConfigManager.java:807) [jsf-impl.jar:]

                    at com.sun.faces.config.ConfigManager.initialize(ConfigManager.java:348) [jsf-impl.jar:]

                 

                Is there anything I can do to solve it?

                 

                Thanks,

                Ulrich

                • 5. Re: Using another JSF implementation in JBoss AS 7.0.1
                  ssilvert

                  I'm working on Mojarra 2.1 integration into AS 7.1 right now.  When I'm done you will be able to get the new JandexAnnotationProvider that works with Mojarra 2.1.  If you bundle that with your WAR it might fix the problem. 

                   

                  If you want to try it today, there is a version of that provider in this Mojarra 2.1 preview branch:

                  https://github.com/ssilvert/jboss-as/commits/JSF_20_to_JSF_21

                   

                  Stan

                  • 6. Re: Using another JSF implementation in JBoss AS 7.0.1
                    blep

                    Hi,

                     

                    I try to run a JSF 2.0 web app with the WAR_BUNDLES_JSF_IMPL and I'm facing exactly the same problem (Caused by: javax.faces.FacesException: Class org.jboss.as.web.deployment.jsf.JandexAnnotationProvider is not an instance of com.sun.faces.spi.AnnotationProvider).

                     

                    It seems I'm stuck with JSF2.0 because Webflow 2.3 currently has an issue with JSF 2.1 (cf. http://forum.springsource.org/showthread.php?106513-SWF-2.3-amp-JSF-2.1-UnsupportedOperationException-at-javax.faces.context.FacesContext )

                     

                    Is there any way to make it work?

                     

                    Regards

                    • 7. Re: Using another JSF implementation in JBoss AS 7.0.1
                      gastaldi

                      Hey Blep,

                       

                      This issue has been commented here: https://issues.jboss.org/browse/AS7-1628

                      You are welcome to contribute with patches to JBoss AS7 if desired.

                       

                      Regards,

                       

                      George

                      • 8. Re: Using another JSF implementation in JBoss AS 7.0.1
                        ssilvert

                        AS 7.0.1 is already using JSF Mojarra 2.0.4.   So you don't need WAR_BUNDLES_JSF_IMPL if you are using that.

                         

                        If you are using AS 7.1.x then it is possible to get Mojarra 2.0 to work but it will require some surgery and I don't know how sucessful that might be.   The version of JandexAnnotationProvider for Mojarra 2.0 is found in jboss-as-web-7.0.1.Final.jar.

                         

                        You might be better off trying a version of MyFaces instead.

                         

                        Stan

                        • 9. Re: Using another JSF implementation in JBoss AS 7.0.1
                          surajchhetry

                          Dear All,

                            I have same issue. I am getting following error when iam using myfaces with jboss 7.1.1 Final.  Here is my stacktrace

                           

                          Error configuring application listener of class com.sun.faces.config.ConfigureListener: java.lang.ClassNotFoundException: com.sun.faces.config.ConfigureListener from [Module "deployment.etopup-ear.ear.etopup.war:main" from Service Module Loader]

                                    at org.jboss.modules.ModuleClassLoader.findClass(ModuleClassLoader.java:190)

                                    at org.jboss.modules.ConcurrentClassLoader.performLoadClassUnchecked(ConcurrentClassLoader.java:468)

                                    at org.jboss.modules.ConcurrentClassLoader.performLoadClassChecked(ConcurrentClassLoader.java:456)

                                    at org.jboss.modules.ConcurrentClassLoader.performLoadClass(ConcurrentClassLoader.java:398)

                                    at org.jboss.modules.ConcurrentClassLoader.loadClass(ConcurrentClassLoader.java:120)

                                    at org.jboss.as.web.deployment.WebInjectionContainer.newInstance(WebInjectionContainer.java:72) [jboss-as-web-7.1.1.Final.jar:7.1.1.Final]

                                    at org.apache.catalina.core.StandardContext.contextListenerStart(StandardContext.java:3342) [jbossweb-7.0.13.Final.jar:]

                                    at org.apache.catalina.core.StandardContext.start(StandardContext.java:3850) [jbossweb-7.0.13.Final.jar:]

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

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

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

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

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

                                    at java.lang.Thread.run(Thread.java:680) [classes.jar:1.6.0_31]

                           

                           

                          Here is dependancy POM

                           

                          <!-- JSF -->

                            <dependency>

                                                        <groupId>org.apache.myfaces.core</groupId>

                            <artifactId>myfaces-api</artifactId>

                            <version>2.1.7</version>

                            </dependency>

                           

                            <dependency>

                                                        <groupId>org.apache.myfaces.core</groupId>

                            <artifactId>myfaces-impl</artifactId>

                            <version>2.1.7</version>

                            </dependency>

                          </dependencies>

                           

                          and web.xml

                          <context-param>

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

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

                          </context-param>


                          • 10. Re: Using another JSF implementation in JBoss AS 7.0.1
                            jaysensharma

                            Hi Suraj,

                             

                             

                                           You are getting "java.lang.ClassNotFoundException: com.sun.faces.config.ConfigureListener " which means you application does not cntain this class as part of it's "WEB-INF/lib".   Youwill find that JBos sprovides  JSF1.2 as well as JSF2.0 (default  is JSF2.0) Jars as part of it's modules "/jboss-as-7.1.1.Final/modules/com/sun/jsf-impl/main"

                             

                                           So try creating a "" file inside your applications  "WEB-INF" directory to include this JSF module ...like following:

                             

                            <?xml version="1.0" encoding="UTF-8"?>

                            <jboss-deployment-structure>

                              <deployment>

                                <dependencies>

                                       <module name="com.sun.jsf-impl" slot="1.2" />      <!-- If you want to use JSF1.2 then use slot=1.2   othereise by default it will be jsf2.0  -->

                             

                                </dependencies>

                              </deployment>

                            </jboss-deployment-structure>

                            • 11. Re: Using another JSF implementation in JBoss AS 7.0.1
                              surajchhetry

                              Hi Jay,

                                 I am using JSF 2 ( Myfaces 2.1.7 ) and I have added jboss-deployment-structure.xml file inside WEB-INF directory with following contains but still I am getting same error.

                               

                              <?xml version="1.0" encoding="UTF-8"?>

                              <jboss-deployment-structure xmlns="urn:jboss:deployment-structure:1.0">

                               

                               

                                <deployment>

                                  <dependencies>

                                    <module name="javax.faces.api" slot="main" export="true"/>

                               

                                  </dependencies>

                                  <exclusions>

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

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

                                    </exclusions>

                                </deployment>

                                <sub-deployment name="etopup.war">

                                  <exclusions>

                                    <module name="javaee.api"/>

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

                                  </exclusions>

                                  <dependencies>

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

                                  </dependencies>

                                </sub-deployment>

                              </jboss-deployment-structure>

                              • 12. Re: Using another JSF implementation in JBoss AS 7.0.1
                                aichernig

                                I am also still struggeling while trying to deploy an EAR into JAS 7.1 which is using Apache MyFaces 2.1.7 (which is working fine in JAS6.1) and could not find any hints how to proceed...

                                 

                                What I have tried so far:

                                 

                                • Learned that in JAS 7 there is only one module for JSF, which is Mojara. So I added WAR_BUNDLES_JSF_IMPL to my web.xml
                                • Created a new module in JAS7 for myfaces
                                • Created a jboss-deployment-structure.xml and placed it in EAR\META-INF where JAS7 jsf modules are excluded and my MyFaces module is included
                                • Then I found, that JAS 7.1.1 has a bug related to WAR_BUNDLES_JSF_IMPL, and as this seems to be fixed for 7.1.2 but now 7.1.2 was available for download, I checked out the source from GIT and built my own version of 7.1.2

                                 

                                But still, when I start JAS7.1.2, I get the following error:

                                 

                                [org.apache.myfaces.webapp.AbstractFacesInitializer] (MSC service thread 1-4) An error occured while initializing MyFaces: Class org.jboss.as.weld.webtier.jsf.WeldApplicationFactory is no javax.faces.application.ApplicationFactory

                                 

                                Then I have started to look into the JSF integration in JAS6, and found, that there is a jbos-faces.jar along with the myfaces libs in jsf.deployer\myfaces. Unfortunatly this file has some dependencies on JARs that are in JAS6\lib and JAS\common\lib, like jboss-mc-int-servlet.jar etc. I wonder if it is save to include all those jars from JAS6 in my myfaces module in JAS7. Is there anybody who has implemented a jboss-faces.jar for myfaces that is working with JAS7? Or, is there anybody who has succeeded to deploy a myfaces based web app on JAS7? I am starting to doubt that this is  possible...

                                Any kind of help or hint is highly appreciated..

                                Thanks

                                Thomas


                                • 13. Re: Using another JSF implementation in JBoss AS 7.0.1
                                  bolke

                                  Hi Thomas,

                                   

                                  I'm struggeling with the same issue. Did you ever get this solved?

                                   

                                  Thanks

                                  Bolke

                                  • 14. Re: Using another JSF implementation in JBoss AS 7.0.1
                                    ssilvert

                                    First, there is no reason to use jboss-deployment-structure.xml for configuring the JSF version.   If you want the Mojarra JSF 1.2 version that ships with JBoss AS then you should set this in web.xml:

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

                                     

                                    If you want to use MyFaces then you should bundle it with your war and set this in web.xml:

                                    <context-param>
                                          <param-name>org.jboss.jbossfaces.WAR_BUNDLES_JSF_IMPL</param-name>
                                          <param-value>true</param-value>
                                    </context-param>

                                     

                                    In the next week or two, I'll be merging the next generation of JSF support.  It allows you to use any MyFaces or Mojarra version and it is fully integrated with the container.

                                    See Design of AS7 multi-JSF feature

                                     

                                    Stan

                                    1 2 3 Previous Next