1 2 Previous Next 15 Replies Latest reply on Jul 21, 2011 2:16 PM by prasad.deshpande

    [EAR deployment] War classes cannot see EJB classes

    guinotphil

      Hello,

       

      I've been starting playing with JBoss AS 7.0 for the past the weeks and it's very exciting and interesting.

       

      I'm now familiar with the modules and dependencies.

       

      Now, I'm trying to deploy an EAR application with a WAR module and an EJB module.

      The problem is that I get a java.lang.NoClassDefFoundError caused by: java.lang.ClassNotFoundException when a class from the WAR module need a class from the EJB module.

       

      MyTest.EAR:

      EarContent
         |
         |---- lib                                  (seam 2.2 libraries)

         |      |---- hibernate-annotations.jar

         |      |---- hibernate-commons-annotations.jar
         |      |---- hibernate-core.jar

         |      |---- hibernate-entitymanager.jar

         |      |---- hibernate-search.jar

         |      |---- hibernate-validator.jar

         |      |---- jboss-el.jar

         |      |----
      jboss-seam.jar

         |---- META-INF

         |      |---- application.xml
         |      |----
      jboss-deployment-structure.xml      (descriped at the end of message)

       

      All jars come from Seam 2.2 as I need to deploy a seam 2.2 application...

       

      The application.xml

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

      <application xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://java.sun.com/xml/ns/javaee" xmlns:application="http://java.sun.com/xml/ns/javaee/application_5.xsd" xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/application_6.xsd" id="Application_ID" version="6">

        <display-name>MyTest.EAR</display-name>

        <module>

          <ejb>MyTest.EJB.jar</ejb>

        </module>

        <module>

          <web>

            <web-uri>MyTest.WAR.war</web-uri>

            <context-root>/test</context-root>

          </web>

        </module>

      </application>

       

       

      The EJB project is very simple, it got only one class: MyClass.java

       

      public class TestClass

      {

          public static void helloWorld() {

              System.out.println("Hello World");

          }

      }

       

      And here is the content of the WAR project:

      MyTest.WAR

      WebContent
         |
         |---- META-INF

         |      |---- MANIFEST.MF       
            (descriped at the end of message)
         |---- WEB-INF

         |      |---- lib/                     (empty directory)
         |      |----
      web.xml

         |---- test.page.xml

         |

      src

         |
         |----seam.properties                   (empty file)

         |----src/test

         |      |---- SeamClass.java

       

       

      web.xml defines the standard servlet mapping:

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

      <web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://java.sun.com/xml/ns/javaee" xmlns:web="http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd" xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd" id="WebApp_ID" version="2.5">

        <display-name>MyTest.WAR</display-name>

       

          <listener>

              <listener-class>

                  org.jboss.seam.servlet.SeamListener

              </listener-class>

          </listener>

       

          <filter>

              <filter-name>Seam Filter</filter-name>

              <filter-class>org.jboss.seam.web.SeamFilter</filter-class>

              <init-param>

                  <param-name>createTempFiles</param-name>

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

              </init-param>

          </filter>

          <filter-mapping>

              <filter-name>Seam Filter</filter-name>

              <url-pattern>/*</url-pattern>

          </filter-mapping>

          <servlet>

              <servlet-name>Faces Servlet</servlet-name>

              <servlet-class>javax.faces.webapp.FacesServlet</servlet-class>

              <load-on-startup>1</load-on-startup>

          </servlet>

          <servlet-mapping>

              <servlet-name>Faces Servlet</servlet-name>

              <url-pattern>*.jsf</url-pattern>

          </servlet-mapping>

          <context-param>

              <param-name>javax.faces.DEFAULT_SUFFIX</param-name>

              <param-value>.xhtml</param-value>

          </context-param>  

      </web-app>

       

      test.page.xml just call a method from SeamClass :

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

      <page xmlns="http://jboss.com/products/seam/pages"

               xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://jboss.com/products/seam/pages http://jboss.com/products/seam/pages-2.1.xsd">

           <begin-conversation join="true" />

           <action execute="#{seamClass.helloWorld()}" />

      </page>

       

      And here is SeamClass:

       

      package test;

       

      import org.jboss.seam.annotations.Scope;

      import org.jboss.seam.ScopeType;

      import org.jboss.seam.annotations.Name;

       

      @Name("seamClass")

      @Scope(ScopeType.CONVERSATION)

      public class SeamClass

      {

          public void helloWorld() {

              System.out.println("Entering....");

              MyClass.helloWorld();

          }

      }

       

      After deploy, when I call http://localhost:8080/test/test.jsf, I get the following output:

      11:21:53,023 INFO  [stdout] (http--127.0.0.1-8080-1) Entering...

       

      11:21:53,023 GRAVE [org.jboss.seam.jsf.SeamPhaseListener] (http--127.0.0.1-8080-1) swallowing exception: javax.el.ELException: java.lang.reflect.InvocationTargetException

          at org.jboss.el.util.ReflectionUtil.invokeMethod(ReflectionUtil.java:339) [jboss-el.jar:]

          at org.jboss.el.util.ReflectionUtil.invokeMethod(ReflectionUtil.java:280) [jboss-el.jar:]

          at org.jboss.el.parser.AstMethodSuffix.getValue(AstMethodSuffix.java:59) [jboss-el.jar:]

          at org.jboss.el.parser.AstMethodSuffix.invoke(AstMethodSuffix.java:65) [jboss-el.jar:]

          at org.jboss.el.parser.AstValue.invoke(AstValue.java:96) [jboss-el.jar:]

          at org.jboss.el.MethodExpressionImpl.invoke(MethodExpressionImpl.java:276) [jboss-el.jar:]

          at org.jboss.seam.core.Expressions$2.invoke(Expressions.java:221) [jboss-seam.jar:]

          at org.jboss.seam.navigation.Page.preRender(Page.java:311) [jboss-seam.jar:]

          at org.jboss.seam.navigation.Pages.preRender(Pages.java:351) [jboss-seam.jar:]

          at org.jboss.seam.jsf.SeamPhaseListener.preRenderPage(SeamPhaseListener.java:560) [jboss-seam.jar:]

          at org.jboss.seam.jsf.SeamPhaseListener.beforeRenderResponse(SeamPhaseListener.java:471) [jboss-seam.jar:]

          at org.jboss.seam.jsf.SeamPhaseListener.beforeServletPhase(SeamPhaseListener.java:147) [jboss-seam.jar:]

          at org.jboss.seam.jsf.SeamPhaseListener.beforePhase(SeamPhaseListener.java:117) [jboss-seam.jar:]

          at com.sun.faces.lifecycle.Phase.handleBeforePhase(Phase.java:214) [jsf-impl-1.2_13.jar:1.2_13-b01-FCS]

          at com.sun.faces.lifecycle.Phase.doPhase(Phase.java:96) [jsf-impl-1.2_13.jar:1.2_13-b01-FCS]

          at com.sun.faces.lifecycle.LifecycleImpl.render(LifecycleImpl.java:139) [jsf-impl-1.2_13.jar:1.2_13-b01-FCS]

          at javax.faces.webapp.FacesServlet.service(FacesServlet.java:266) [jsf-api-1.2_13.jar:1.2_13-b01-FCS]

          at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:329) [jbossweb-7.0.0.CR4.jar:7.1.0.Alpha1-SNAPSHOT]

          at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:248) [jbossweb-7.0.0.CR4.jar:7.1.0.Alpha1-SNAPSHOT]

          at org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:83) [jboss-seam.jar:]

          at org.jboss.seam.web.IdentityFilter.doFilter(IdentityFilter.java:40) [jboss-seam.jar:]

          at org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:69) [jboss-seam.jar:]

          at org.jboss.seam.web.MultipartFilter.doFilter(MultipartFilter.java:90) [jboss-seam.jar:]

          at org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:69) [jboss-seam.jar:]

          at org.jboss.seam.web.ExceptionFilter.doFilter(ExceptionFilter.java:64) [jboss-seam.jar:]

          at org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:69) [jboss-seam.jar:]

          at org.jboss.seam.web.RedirectFilter.doFilter(RedirectFilter.java:45) [jboss-seam.jar:]

          at org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:69) [jboss-seam.jar:]

          at org.jboss.seam.servlet.SeamFilter.doFilter(SeamFilter.java:158) [jboss-seam.jar:]

          at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:280) [jbossweb-7.0.0.CR4.jar:7.1.0.Alpha1-SNAPSHOT]

          at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:248) [jbossweb-7.0.0.CR4.jar:7.1.0.Alpha1-SNAPSHOT]

          at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:275) [jbossweb-7.0.0.CR4.jar:7.1.0.Alpha1-SNAPSHOT]

          at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:161) [jbossweb-7.0.0.CR4.jar:7.1.0.Alpha1-SNAPSHOT]

          at org.jboss.as.web.NamingValve.invoke(NamingValve.java:57) [jboss-as-web-7.1.0.Alpha1-SNAPSHOT.jar:7.1.0.Alpha1-SNAPSHOT]

          at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:154) [jbossweb-7.0.0.CR4.jar:7.1.0.Alpha1-SNAPSHOT]

          at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102) [jbossweb-7.0.0.CR4.jar:7.1.0.Alpha1-SNAPSHOT]

          at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109) [jbossweb-7.0.0.CR4.jar:7.1.0.Alpha1-SNAPSHOT]

          at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:362) [jbossweb-7.0.0.CR4.jar:7.1.0.Alpha1-SNAPSHOT]

          at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:877) [jbossweb-7.0.0.CR4.jar:7.1.0.Alpha1-SNAPSHOT]

          at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:667) [jbossweb-7.0.0.CR4.jar:7.1.0.Alpha1-SNAPSHOT]

          at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:952) [jbossweb-7.0.0.CR4.jar:7.1.0.Alpha1-SNAPSHOT]

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

      Caused by: java.lang.reflect.InvocationTargetException

          at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) [:1.6.0_22]

          at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) [:1.6.0_22]

          at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) [:1.6.0_22]

          at java.lang.reflect.Method.invoke(Method.java:597) [:1.6.0_22]

          at org.jboss.seam.util.Reflections.invoke(Reflections.java:22) [jboss-seam.jar:]

          at org.jboss.seam.intercept.RootInvocationContext.proceed(RootInvocationContext.java:32) [jboss-seam.jar:]

          at org.jboss.seam.intercept.SeamInvocationContext.proceed(SeamInvocationContext.java:56) [jboss-seam.jar:]

          at org.jboss.seam.transaction.RollbackInterceptor.aroundInvoke(RollbackInterceptor.java:28) [jboss-seam.jar:]

          at org.jboss.seam.intercept.SeamInvocationContext.proceed(SeamInvocationContext.java:68) [jboss-seam.jar:]

          at org.jboss.seam.core.MethodContextInterceptor.aroundInvoke(MethodContextInterceptor.java:44) [jboss-seam.jar:]

          at org.jboss.seam.intercept.SeamInvocationContext.proceed(SeamInvocationContext.java:68) [jboss-seam.jar:]

          at org.jboss.seam.intercept.RootInterceptor.invoke(RootInterceptor.java:107) [jboss-seam.jar:]

          at org.jboss.seam.intercept.JavaBeanInterceptor.interceptInvocation(JavaBeanInterceptor.java:185) [jboss-seam.jar:]

          at org.jboss.seam.intercept.JavaBeanInterceptor.invoke(JavaBeanInterceptor.java:103) [jboss-seam.jar:]

          at test.SeamClass_$$_javassist_seam_2.helloWorld(SeamClass_$$_javassist_seam_2.java) [classes:]

          at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) [:1.6.0_22]

          at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) [:1.6.0_22]

          at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) [:1.6.0_22]

          at java.lang.reflect.Method.invoke(Method.java:597) [:1.6.0_22]

          at org.jboss.el.util.ReflectionUtil.invokeMethod(ReflectionUtil.java:335) [jboss-el.jar:]

          ... 41 more

      Caused by: java.lang.NoClassDefFoundError: test/TestClass

          at test.SeamClass.helloWorld(SeamClass.java:13) [classes:]

          ... 61 more

      Caused by: java.lang.ClassNotFoundException: test.TestClass from [Module "deployment.MyTest.EAR.ear.MyTest.WAR.war:main" from Service Module Loader]

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

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

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

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

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

          ... 62 more

       

      It entered into the seam component method, but cannot find the class in the EJB module.

       

      I've tried to deploy the EAR with those settings:

       

      jboss-deployment-structure.xml

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

      <jboss-deployment-structure>

          <ear-subdeployments-isolated>false</ear-subdeployments-isolated>

         

          <deployment>

              <!-- seam dependencies -->

              <exclusions>

                  <module name="com.sun.jsf-impl" />

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

              </exclusions>

              <dependencies>

                  <module name="org.javassist" export="true" />

                  <module name="org.dom4j" export="true" />

                  <module name="com.sun.jsf-impl" slot="1.2" export="true" />

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

                  <module name="org.slf4j" export="true" />

                  <module name="org.apache.commons.logging" export="true" />

              </dependencies>

          </deployment>

       

          <sub-deployment name="MyTest.EJB.jar">

          </sub-deployment>

       

          <sub-deployment name="MyTest.WAR.war">

              <!-- seam / jsf 1.2 dependencies -->

              <exclusions>

                  <module name="com.sun.jsf-impl" />

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

              </exclusions>

              <dependencies>

                  <module name="com.sun.jsf-impl" slot="1.2" />

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

                  <module name="deployment.MyTest.EAR.ear.MyTest.EJB.jar" />

              </dependencies>

          </sub-deployment>

      </jboss-deployment-structure>

       

      As you can see I disabled the subdeployments isolation and set up a dependency from the WAR module to the EJB module. I also put the following dependency in the War module's MANIFEST.MF:

      Manifest-Version: 1.0

      Class-Path:

      Dependencies: deployment.MyTest.EAR.ear.MyTest.EJB.jar

       

       

      But I still can't make subdeployment isolation being disabled and the war module cannot see the ejb module.

       

      What am I doing wrong ? Any kind of help will be welcome.

       

      Thank you !

        • 1. Re: [EAR deployment] War classes cannot see EJB classes
          swd847

          Are you using AS7 Final? sub deployment isoloation should be off by default, so the war should be able to see the EJB jar unless you explicitly enable sub deployment isolation.

           

          I can't help noticing that your stack trace does not match up with the classes you have posted:

           

          java.lang.ClassNotFoundException: test.TestClass

           

          When the code has test.MyClass

           

          Is it possible that you are deploying stale bytecode? Maybe you could try a clean rebuild.

          • 2. Re: [EAR deployment] War classes cannot see EJB classes
            guinotphil

            Yeah, I've tried JBoss 7.0.0.Final as well as a nightly build of JBoss 7.1.0..

             

            I'll check what you mean about the strack trace, but I guess it's a copy / paste error, as I actually renamed the class while re-writing this example. However I remember running it agan after that. But, I'll try a clean rebuild and post the correct stractstace ASAP.

            • 3. Re: [EAR deployment] War classes cannot see EJB classes
              guinotphil

              I've corrected the original message. The class has always been called TestClass and not MyClass, this was a typo when I wrote the issue. Sorry about this.

               

              I've tried with many configuration actually:

              - without isolation settings (should be disabled by default as you say) - not working

              - with isolation set to false - not working

              - with isolation enabled and setting up a dependency - not working.

               

              I've also tried to set

               

              <subsystem xmlns="urn:jboss:domain:ee:1.0">

                  <ear-subdeployments-isolated>false</ear-subdeployments-isolated>

              </subsystem>

               

              in standalone.xml, but it still does not work !

              • 4. Re: [EAR deployment] War classes cannot see EJB classes
                jaikiran

                Please post the output of

                 

                jar -tf MyTest.ear

                 

                If possible, attach that .ear to this thread.

                • 5. Re: [EAR deployment] War classes cannot see EJB classes
                  guinotphil

                  Hi,

                   

                  Here is the output :

                   

                  META-INF/MANIFEST.MF

                  MyTest.EJB.jar

                  MyTest.WAR.war

                  META-INF/

                  META-INF/application.xml

                  META-INF/jboss-deployment-structure.xml

                  lib/

                  lib/hibernate-annotations.jar

                  lib/hibernate-commons-annotations.jar

                  lib/hibernate-core.jar

                  lib/hibernate-entitymanager.jar

                  lib/hibernate-search.jar

                  lib/hibernate-validator.jar

                  lib/jboss-el.jar

                  lib/jboss-seam.jar

                   

                  I've also joined the ear file as an attachement.

                   

                  Thank you.

                  • 6. Re: [EAR deployment] War classes cannot see EJB classes
                    guinotphil

                    I've tried to add this line in MyTest.WAR/WebContent/META-INF/MANIFEST.MF

                     

                    Class-Path: MyTest.EJB.jar

                     

                    , but I can't still make this ear working..

                     

                     

                    I also even tried to rename the projects MyTestEAR, MyTestEJB and MyTestWAR (instead of MyTest.EAR, MyTest.EJB and MyTest.WAR), in case the . in the name was a problem for a module name; but it still does not work after that !

                     

                    Has anyone succedeed to deploy the posted ear?

                     

                    Thank you

                    • 7. Re: [EAR deployment] War classes cannot see EJB classes
                      jaikiran

                      Did not notice your previous reply. I'll take a look later today.

                      • 8. Re: [EAR deployment] War classes cannot see EJB classes
                        guinotphil

                        Thank you !

                         

                        I've also tried to add the

                        <module name="deployment.MyTestEAR.ear.MyTestEJB.jar" />

                        depency in the EAR deployement description.

                         

                        I've also tried to copy the lib in the EAR's EarContent/lib to the War's WebContent/lib, but it sill doesn't work.

                         

                        I've put a breakpoint in my SeamClass and when I lookup at SeamClass.class.getClassLoader(), I've got :

                        ModuleClassLoader for Module "deployment.MyTestEAR.ear.MyTestWAR.war:main" from Service Module Loader

                         

                        And in the module's path I have

                         

                        [local loader for ModuleClassLoader for Module "org.picketbox:main" from local module loader @208a0544 (roots: C:\DEV\jboss-as-7.1.0.Alpha1-SNAPSHOT\modules),

                        local loader for ModuleClassLoader for Module "javax.transaction.api:main" from local module loader @208a0544 (roots: C:\DEV\jboss-as-7.1.0.Alpha1-SNAPSHOT\modules),

                        local loader for ModuleClassLoader for Module "javax.resource.api:main" from local module loader @208a0544 (roots: C:\DEV\jboss-as-7.1.0.Alpha1-SNAPSHOT\modules),

                        local loader for ModuleClassLoader for Module "javax.activation.api:main" from local module loader @208a0544 (roots: C:\DEV\jboss-as-7.1.0.Alpha1-SNAPSHOT\modules),

                        local loader for ModuleClassLoader for Module "javax.annotation.api:main" from local module loader @208a0544 (roots: C:\DEV\jboss-as-7.1.0.Alpha1-SNAPSHOT\modules),

                        local loader for ModuleClassLoader for Module "javax.xml.soap.api:main" from local module loader @208a0544 (roots: C:\DEV\jboss-as-7.1.0.Alpha1-SNAPSHOT\modules),

                        local loader for ModuleClassLoader for Module "javax.xml.rpc.api:main" from local module loader @208a0544 (roots: C:\DEV\jboss-as-7.1.0.Alpha1-SNAPSHOT\modules),

                        local loader for ModuleClassLoader for Module "javax.ejb.api:main" from local module loader @208a0544 (roots: C:\DEV\jboss-as-7.1.0.Alpha1-SNAPSHOT\modules),

                        local loader for ModuleClassLoader for Module "javax.el.api:main" from local module loader @208a0544 (roots: C:\DEV\jboss-as-7.1.0.Alpha1-SNAPSHOT\modules),

                        local loader for ModuleClassLoader for Module "javax.inject.api:main" from local module loader @208a0544 (roots: C:\DEV\jboss-as-7.1.0.Alpha1-SNAPSHOT\modules),

                        local loader for ModuleClassLoader for Module "javax.enterprise.api:main" from local module loader @208a0544 (roots: C:\DEV\jboss-as-7.1.0.Alpha1-SNAPSHOT\modules),

                        local loader for ModuleClassLoader for Module "javax.enterprise.deploy.api:main" from local module loader @208a0544 (roots: C:\DEV\jboss-as-7.1.0.Alpha1-SNAPSHOT\modules),

                        local loader for ModuleClassLoader for Module "javax.interceptor.api:main" from local module loader @208a0544 (roots: C:\DEV\jboss-as-7.1.0.Alpha1-SNAPSHOT\modules),

                        local loader for ModuleClassLoader for Module "javax.jms.api:main" from local module loader @208a0544 (roots: C:\DEV\jboss-as-7.1.0.Alpha1-SNAPSHOT\modules),

                        local loader for ModuleClassLoader for Module "javax.jws.api:main" from local module loader @208a0544 (roots: C:\DEV\jboss-as-7.1.0.Alpha1-SNAPSHOT\modules),

                        local loader for ModuleClassLoader for Module "javax.mail.api:main" from local module loader @208a0544 (roots: C:\DEV\jboss-as-7.1.0.Alpha1-SNAPSHOT\modules),

                        local loader for ModuleClassLoader for Module "javax.persistence.api:main" from local module loader @208a0544 (roots: C:\DEV\jboss-as-7.1.0.Alpha1-SNAPSHOT\modules),

                        local loader for ModuleClassLoader for Module "javax.security.auth.message.api:main" from local module loader @208a0544 (roots: C:\DEV\jboss-as-7.1.0.Alpha1-SNAPSHOT\modules),

                        local loader for ModuleClassLoader for Module "javax.security.jacc.api:main" from local module loader @208a0544 (roots: C:\DEV\jboss-as-7.1.0.Alpha1-SNAPSHOT\modules),

                        local loader for ModuleClassLoader for Module "javax.servlet.api:main" from local module loader @208a0544 (roots: C:\DEV\jboss-as-7.1.0.Alpha1-SNAPSHOT\modules),

                        local loader for ModuleClassLoader for Module "javax.servlet.jsp.api:main" from local module loader @208a0544 (roots: C:\DEV\jboss-as-7.1.0.Alpha1-SNAPSHOT\modules),

                        local loader for ModuleClassLoader for Module "javax.validation.api:main" from local module loader @208a0544 (roots: C:\DEV\jboss-as-7.1.0.Alpha1-SNAPSHOT\modules),

                        local loader for ModuleClassLoader for Module "javax.ws.rs.api:main" from local module loader @208a0544 (roots: C:\DEV\jboss-as-7.1.0.Alpha1-SNAPSHOT\modules),

                        local loader for ModuleClassLoader for Module "javax.xml.bind.api:main" from local module loader @208a0544 (roots: C:\DEV\jboss-as-7.1.0.Alpha1-SNAPSHOT\modules),

                        local loader for ModuleClassLoader for Module "javax.xml.registry.api:main" from local module loader @208a0544 (roots: C:\DEV\jboss-as-7.1.0.Alpha1-SNAPSHOT\modules),

                        local loader for ModuleClassLoader for Module "javax.xml.ws.api:main" from local module loader @208a0544 (roots: C:\DEV\jboss-as-7.1.0.Alpha1-SNAPSHOT\modules),

                        local loader for ModuleClassLoader for Module "org.apache.santuario.xmlsec:main" from local module loader @208a0544 (roots: C:\DEV\jboss-as-7.1.0.Alpha1-SNAPSHOT\modules),

                        local loader for ModuleClassLoader for Module "org.hibernate.validator:main" from local module loader @208a0544 (roots: C:\DEV\jboss-as-7.1.0.Alpha1-SNAPSHOT\modules),

                        local loader for ModuleClassLoader for Module "org.jboss.as.web:main" from local module loader @208a0544 (roots: C:\DEV\jboss-as-7.1.0.Alpha1-SNAPSHOT\modules),

                        local loader for ModuleClassLoader for Module "sun.jdk:main" from local module loader @208a0544 (roots: C:\DEV\jboss-as-7.1.0.Alpha1-SNAPSHOT\modules),

                        local loader for ModuleClassLoader for Module "org.jboss.logging:main" from local module loader @208a0544 (roots: C:\DEV\jboss-as-7.1.0.Alpha1-SNAPSHOT\modules),

                        local loader for ModuleClassLoader for Module "org.jboss.vfs:main" from local module loader @208a0544 (roots: C:\DEV\jboss-as-7.1.0.Alpha1-SNAPSHOT\modules),

                        local loader for ModuleClassLoader for Module "com.sun.jsf-impl:1.2" from local module loader @208a0544 (roots: C:\DEV\jboss-as-7.1.0.Alpha1-SNAPSHOT\modules),

                        local loader for ModuleClassLoader for Module "javax.servlet.jstl.api:main" from local module loader @208a0544 (roots: C:\DEV\jboss-as-7.1.0.Alpha1-SNAPSHOT\modules),

                        local loader for ModuleClassLoader for Module "javax.faces.api:1.2" from local module loader @208a0544 (roots: C:\DEV\jboss-as-7.1.0.Alpha1-SNAPSHOT\modules),

                        local loader for ModuleClassLoader for Module "deployment.MyTest.EAR.ear.MyTest.WAR.war:main" from Service Module Loader,

                        local loader for ModuleClassLoader for Module "org.javassist:main" from local module loader @208a0544 (roots: C:\DEV\jboss-as-7.1.0.Alpha1-SNAPSHOT\modules),

                        local loader for ModuleClassLoader for Module "org.dom4j:main" from local module loader @208a0544 (roots: C:\DEV\jboss-as-7.1.0.Alpha1-SNAPSHOT\modules),

                        local loader for ModuleClassLoader for Module "org.slf4j:main" from local module loader @208a0544 (roots: C:\DEV\jboss-as-7.1.0.Alpha1-SNAPSHOT\modules),

                        local loader for ModuleClassLoader for Module "org.slf4j.jcl-over-slf4j:main" from local module loader @208a0544 (roots: C:\DEV\jboss-as-7.1.0.Alpha1-SNAPSHOT\modules),

                        local loader for ModuleClassLoader for Module "deployment.MyTest.EAR.ear:main" from Service Module Loader]

                         

                        which does not include the deployment.MyTest.EAR.ear.MyTest.EJB.jar:main depency that I've added.

                         

                        I really don't understand what's going wrong ! I must miss something obvious, because, I just aimed to deploy a basic ear example as explained in the documentation: https://docs.jboss.org/author/display/AS7/Class+Loading+in+AS7

                         

                        "If the ear-subdeployments-isolated is set to false, then the classes in web.war can access classes belonging to ejb1.jar and ejb2.jar."

                        • 9. Re: [EAR deployment] War classes cannot see EJB classes
                          prasad.deshpande

                          Following things you'd need to do,

                           

                          1. MyTest.EJB.jar is not actually ejb jar, no ejb's are inside, so remove reference from application.xml & move this jar to lib directory of ear

                          2. Remove sub-deployment of "MyTest.EJB.jar" from jboss-deployment-structure.xml & comment entry in <sub-deployment name="MyTest.WAR.war"> & remove MyTest.EJB.jar as a resource, once you move to lib dir, you don't need that entry anymore.

                          3. Remove "Dependencies" from "MyTest.WAR.war/META-INF/MANIFEST.MF". It sould then deploy easily.

                           

                          I've attached modified ear with this post that worked (just deploy as it is & access the page.) for me and printed once I accessed http://localhost:8080/test/test.jsf...

                           

                          15:11:52,281 INFO  [stdout] (http-0.0.0.0-0.0.0.0-8080-2) Entering...

                          15:11:52,281 INFO  [stdout] (http-0.0.0.0-0.0.0.0-8080-2) Hello World

                          Although, it printed on console, web page still shows 404 page. I didn't debug much for it, but this should be ok for you to get started.

                          • 10. Re: [EAR deployment] War classes cannot see EJB classes
                            jaikiran

                            Hmm, so it isn't a subdeployment after all. I have to check the spec on what it says about "dubious" modules (a.k.a sub-deployments) in the application.xml.

                            • 11. Re: [EAR deployment] War classes cannot see EJB classes
                              guinotphil

                              Thank you for your help.

                               

                              Well, it was a simple project to start with, but after that I have to migrate an application to JBoss AS7. That's why I wanted to deploy a war and a jar (and not a lib)

                               

                              The same mini-project is actually working on JBoss AS 4 (except that I have to put the libs into the WAR as well). So, JBoss AS 7 must handle the EJB in a different way.

                               

                              When  you say "MyTest.EJB.jar is not actually ejb jar, no ejb's are inside", does this mean that I can access only the ejb and not all the classes on a jar module from the war ?

                              Or, is it that I have to add ejb into the jar to make it really deployed, and then the class loader will see the module ?

                              • 12. Re: [EAR deployment] War classes cannot see EJB classes
                                jaikiran

                                guinotphil wrote:

                                 

                                Or, is it that I have to add ejb into the jar to make it really deployed, and then the class loader will see the module ?

                                Yes, that should get you going.

                                • 13. Re: [EAR deployment] War classes cannot see EJB classes
                                  prasad.deshpande

                                  You can choose not to put jar in lib directory, but then classes in that jar must be visible to your modules (ejb/war). By default jars that are put in lib directory will be visible to (ejb/war) modules (subdeployments).

                                   

                                  In your case, since your "MyTest.EJB.jar" does not have any bean inside it, it's technically not an EJB module (sub-deployment). So you should not refer that as ejb module inside your application.xml.

                                   

                                  If you want to keep your jar directly in ear (at same level as your WAR), then it must be refered using Class-path: in manifest of any jar that is in lib directory so that it will be visible to ear classloader. In your case, if you want to try then, just add "Class-path: ../MyTest.EJB.jar" line to manifest of any of your jar in lib directory, it will work.

                                   

                                  It is also possible to add module dependencies on other modules inside the deployment using the Class-Path manifest entry. This can be used within an ear to set up dependencies between sub deployments, and also to allow modules access to additional jars deployed in an ear that are not sub deployments and are not in the EAR/lib directory. If a jar in the EAR/lib directory references a jar via Class-Path: then this additional jar is merged into the parent ear's module, and is accessible to all sub deployments in the ear.

                                  • 14. Re: [EAR deployment] War classes cannot see EJB classes
                                    guinotphil

                                    Heu, sorry, I don't understand...

                                     

                                    If I want my war (MyTest.WAR.war) to see the classes in my jar (MyTest.EJB.jar), I have to edit the MANIFEST of all the jars which are in EarContent/lib ??!!

                                     

                                    Isn't there a simplier way to add the jar in the ear classpath ?! (As said before, adding the <module name="deployment.MyTestEAR.ear.MyTestEJB.jar" /> depency in the EAR deployement descriptio does not work)

                                    1 2 Previous Next