4 Replies Latest reply on Apr 3, 2013 12:55 PM by Deibys Quintero

    JSF libraries on JBossAS 7.0.1 classpath

    Robert Baty Newbie

      I'm working on an application that utilizes JSF on JBossAS 7.0.1.  The application uses Spring and the




      class to allow for Spring injection into JSF beans.  In addition, the Spring libraries are packaged at the EAR level since they are used by multiple modules besides just the JSF WAR.


      With this packaging, I initially was getting


      java.lang.ClassNotFoundException: javax.faces.context.FacesContext
      at org.jboss.modules.ModuleClassLoader.findClass(ModuleClassLoader.java:191) [jboss-modules.jar:1.0.1.GA]
      at org.jboss.modules.ConcurrentClassLoader.performLoadClassChecked(ConcurrentClassLoader.java:358) [jboss-modules.jar:1.0.1.GA]
      at org.jboss.modules.ConcurrentClassLoader.performLoadClassChecked(ConcurrentClassLoader.java:330) [jboss-modules.jar:1.0.1.GA]
      at org.jboss.modules.ConcurrentClassLoader.performLoadClass(ConcurrentClassLoader.java:307) [jboss-modules.jar:1.0.1.GA]
      at org.jboss.modules.ConcurrentClassLoader.loadClass(ConcurrentClassLoader.java:101) [jboss-modules.jar:1.0.1.GA]
      at org.springframework.web.jsf.el.SpringBeanFacesELResolver.getWebApplicationContext(SpringBeanFacesELResolver.java:90) [org.springframework.web-3.0.5.RELEASE.jar:]
      at org.springframework.web.jsf.el.SpringBeanFacesELResolver.getBeanFactory(SpringBeanFacesELResolver.java:79) [org.springframework.web-3.0.5.RELEASE.jar:]
      at org.springframework.beans.factory.access.el.SpringBeanELResolver.getValue(SpringBeanELResolver.java:50) [org.springframework.beans-3.0.5.RELEASE.jar:]


      Which I found strange because I thought the JSF libraries were supposed to be on the classloader by default?  To resolve this problem I added the following to the MANFEST.MF of the WAR that uses JSF.


      Dependencies: javax.faces.api services


      This seems to solve the problem by putting JSF on the classpath but I am wondering why this is happening?





        • 1. Re: JSF libraries on JBossAS 7.0.1 classpath
          Stan Silvert Master

          AS7 only puts JSF on the WAR's classpath.  IMO, it doesn't belong on the EAR's classpath because JSF relies on the servlet API which is not available at the EAR level.


          I'm not sure why your manifest change worked, but it's good to know!



          • 2. Re: JSF libraries on JBossAS 7.0.1 classpath
            Robert Baty Newbie


            Yeah that makes sense to me and I was thinking because the Spring




            class is loaded from the EAR level and it was looking for a JSF class that was the original reason this issue occurred.  However, I am not sure why the WAR MANIFEST.MF change of


            Dependencies: javax.faces.api services


            fixes this.  I was thinking I would have to add that Dependency to the EAR MANIFEST.MF file right?



            • 3. Re: JSF libraries on JBossAS 7.0.1 classpath
              Stan Silvert Master

              Robert Baty wrote:


              I was thinking I would have to add that Dependency to the EAR MANIFEST.MF file right?


              I think the same as you.  But I'm not sure how that manifest part works under the covers.  I suspect that adding it to the EAR instead would also work.



              • 4. Re: JSF libraries on JBossAS 7.0.1 classpath
                Deibys Quintero Newbie

                Hello guys,


                I am having an issue similar to the one you had, so I guess it is better to continue this post.


                I am trying to deploy an ear project.  One of the jar I add to the lib folder is dependent on JSF libraries.


                When I deploy the ear , I get the following exception:

                Caused by: java.lang.ClassNotFoundException: javax.faces.validator.Validator from [Module "deployment.Perfil-Ear.ear:main" from Service Module Loader]


                I guess it is OK, because from the ear classpath there is no JSF libraries.  When I add to the ear´s lib folder an implementation of the JSF mojarra, the deployment is OK.


                The issue It is that I dont want to package an jar implementation of JSF into my ear, instead I want to load the JSF libs already contained in JBOSS AS 7


                I have tried to change my ear MANIFEST.MF file with different combinations but no-one has worked.


                I Have used:


                Manifest-Version: 1.0

                Dependencies: javax.faces.api services


                Manifest-Version: 1.0

                Dependencies: javax.faces.api export


                Manifest-Version: 1.0

                Dependencies: javax.faces.api