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

    JSF libraries on JBossAS 7.0.1 classpath

    rjbaty

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

       

      <el-resolver>org.springframework.web.jsf.el.SpringBeanFacesELResolver</el-resolver>

       

      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?

       

      Thanks,

       

      Robert

        • 1. Re: JSF libraries on JBossAS 7.0.1 classpath
          ssilvert

          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!

           

          Stan

          • 2. Re: JSF libraries on JBossAS 7.0.1 classpath
            rjbaty

            Stan,

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

             

            org.springframework.web.jsf.el.SpringBeanFacesELResolver

             

            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?

             

            Robert

            • 3. Re: JSF libraries on JBossAS 7.0.1 classpath
              ssilvert

              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.

               

              Stan

              • 4. Re: JSF libraries on JBossAS 7.0.1 classpath
                deibys

                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