3 Replies Latest reply on Mar 1, 2013 12:53 AM by rahul22

    strange behaviour in jboss-jsf-api ??

    rahul22

      hi,

       

      i want to add jsf-api to my ejb module .

       

      if i add

       

      {code}

      <dependency>

                  <groupId>org.jboss.spec.javax.faces</groupId>

                  <artifactId>jboss-jsf-api_2.1_spec</artifactId>

                  <scope>provided</scope>

              </dependency>

      {code}

       

       

      in pom.xml then

      m getting

       

      {code}

      17:28:23,907 ERROR [org.jboss.msc.service.fail] (MSC service thread 1-4) MSC00001: Failed to start service jboss.deployment.subunit."xxx-ee.ear"."xxx-core-0.0.1-SNAPSHOT.jar".POST_MODULE: org.jboss.msc.service.StartException in service jboss.deployment.subunit."xxx-ee.ear"."xxx-core-0.0.1-SNAPSHOT.jar".POST_MODULE: Failed to process phase POST_MODULE of subdeployment "xxx-core-0.0.1-SNAPSHOT.jar" of deployment "xxx-ee.ear"

          at org.jboss.as.server.deployment.DeploymentUnitPhaseService.start(DeploymentUnitPhaseService.java:119) [jboss-as-server-7.1.1.Final.jar:7.1.1.Final]

          at org.jboss.msc.service.ServiceControllerImpl$StartTask.startService(ServiceControllerImpl.java:1811) [jboss-msc-1.0.2.GA.jar:1.0.2.GA]

          at org.jboss.msc.service.ServiceControllerImpl$StartTask.run(ServiceControllerImpl.java:1746) [jboss-msc-1.0.2.GA.jar:1.0.2.GA]

          at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1110) [rt.jar:1.7.0]

          at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:603) [rt.jar:1.7.0]

          at java.lang.Thread.run(Thread.java:722) [rt.jar:1.7.0]

      Caused by: java.lang.RuntimeException: Error getting reflective information for class com.xxx.seam.session.oconsole.ApplicationFileBean with ClassLoader ModuleClassLoader for Module "deployment.xxx-ee.ear.xxx-core-0.0.1-SNAPSHOT.jar:main" from Service Module Loader

          at org.jboss.as.server.deployment.reflect.DeploymentReflectionIndex.getClassIndex(DeploymentReflectionIndex.java:70) [jboss-as-server-7.1.1.Final.jar:7.1.1.Final]

          at org.jboss.as.ee.metadata.MethodAnnotationAggregator.runtimeAnnotationInformation(MethodAnnotationAggregator.java:58)

          at org.jboss.as.ee.component.deployers.InterceptorAnnotationProcessor.handleAnnotations(InterceptorAnnotationProcessor.java:85)

          at org.jboss.as.ee.component.deployers.InterceptorAnnotationProcessor.processComponentConfig(InterceptorAnnotationProcessor.java:70)

          at org.jboss.as.ee.component.deployers.InterceptorAnnotationProcessor.deploy(InterceptorAnnotationProcessor.java:55)

          at org.jboss.as.server.deployment.DeploymentUnitPhaseService.start(DeploymentUnitPhaseService.java:113) [jboss-as-server-7.1.1.Final.jar:7.1.1.Final]

          ... 5 more

      Caused by: java.lang.NoClassDefFoundError: Ljavax/faces/context/FacesContext;

          at java.lang.Class.getDeclaredFields0(Native Method) [rt.jar:1.7.0]

          at java.lang.Class.privateGetDeclaredFields(Class.java:2308) [rt.jar:1.7.0]

          at java.lang.Class.getDeclaredFields(Class.java:1760) [rt.jar:1.7.0]

          at org.jboss.as.server.deployment.reflect.ClassReflectionIndex.<init>(ClassReflectionIndex.java:57) [jboss-as-server-7.1.1.Final.jar:7.1.1.Final]

          at org.jboss.as.server.deployment.reflect.DeploymentReflectionIndex.getClassIndex(DeploymentReflectionIndex.java:66) [jboss-as-server-7.1.1.Final.jar:7.1.1.Final]

          ... 10 more

      Caused by: java.lang.ClassNotFoundException: javax.faces.context.FacesContext from [Module "deployment.xxx-ee.ear.xxx-core-0.0.1-SNAPSHOT.jar: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)

          ... 15 more

      {code}

       

      and if i add

       

      {code}

      <dependency>

                  <groupId>org.jboss.spec.javax.faces</groupId>

                  <artifactId>jboss-jsf-api_2.1_spec</artifactId>

              </dependency>

      {code}

      then no error .

       

      the difference is in the above case i will find the jar in EAR but with provided i will not . and actually m using manifest to put required jars on classppath so that EJB can use them from EAR.

      if its provided then maven will not add that to manifest.

       

      so what to do , to put jar in manifest when its provided in pom ??? or something else is the case ???

      Please clear this doubt .

      help !!

       

      THanks

        • 1. Re: strange behaviour in jboss-jsf-api ??
          sfcoy

          The JSF api's are only made available to web modules. If you reference them in EJBs or utility classes in the EAR you will get CNFEs.

           

          If you have a look at AS71 Class Loading in AS7, you should be able to figure out how to make the module containing the JSF classes available to the rest of your application.

          1 of 1 people found this helpful
          • 2. Re: strange behaviour in jboss-jsf-api ??
            rahul22

            hi,

             

            Thanks for the reply .

             

            yes its correct , they are for web module . but if m referencing them in EJB , m also providing dependency .

             

            and my concern was adding in pom with provided so not to add  in EAR package and put on manifest so it become available.

             

            i will go through your link .

             

            thanks

            • 3. Re: strange behaviour in jboss-jsf-api ??
              rahul22

              hi,

               

               

              we can put a manifest entry for jsf-api in pom.xml to make it available as provided. THen only it will be given by jboss 7 . normally only provided to web- module.

               

              Thanks