3 Replies Latest reply on Mar 15, 2012 5:39 AM by Prasad Deshpande

    Migrating to AS7

    Fabrizio Boco Newbie

      Hi everybody,

       

      I am migrating an AS6 application to AS7.

       

      My EJBs use a custom library which is packaged into the jar file.

       

      When I deploy the ear file I get the error:

       

       

      ...
      Caused by: java.lang.NoClassDefFoundError: org/myPackage/MyClass
      ...
      

       

      So I have modified the jboss-deployment-structure.xml as follows

       

       

      <jboss-deployment-structure xmlns="urn:jboss:deployment-structure:1.1">
          <ear-subdeployments-isolated>false</ear-subdeployments-isolated>
          <deployment>
              <dependencies>
                  <module name="javax.faces.api" slot="1.2" export="true" />
                  <module name="org.apache.commons.logging" export="true" />
                  <module name="org.dom4j" export="true" />
              </dependencies>
      
              <resources>
                  <resource-root path="MyLibrary.jar" />
              </resources>
      
          </deployment>
      
          <sub-deployment name="MyApp.war">
              <exclusions>
                  <module name="javax.faces.api" slot="main" />
              </exclusions>
              <dependencies>
                  <module name="javax.faces.api" slot="1.2" /> 
              </dependencies>
          </sub-deployment>
      
          <sub-deployment name="MyApp.jar">
              <dependencies>
                  <system>
                      <paths>
                          <path name="org.myPackage.MyClass" />
                      </paths>
                  </system>
              </dependencies>
          </sub-deployment>
      
      
      </jboss-deployment-structure>
      

       

      But this does't solve the problem.

       

      Can anyone provide some help ?

       

      Thanks

       

      Fab.

        • 1. Re: Migrating to AS7
          Prasad Deshpande Expert

          Fabrizio Boco wrote:

           

          ...
          Caused by: java.lang.NoClassDefFoundError: org/myPackage/MyClass
          ...
          

           

          If that's the only reason you added "MyApp.jar" in jboss-deployment-structure.xml & if that jar doesn't contain any components (just like a library jar), then you can simply drop "MyApp.jar" in your EAR/lib directory & remove that subdeployment node from that XML & class should be available to your EJB's.

          • 2. Re: Migrating to AS7
            Fabrizio Boco Newbie

            Hi Prasad,

             

            MyApp.jar contains some classes (one of them is MyClass) which are used by my EJBs.

             

            I can't remove the library.

             

            Thanks

             

            Fab.

            • 3. Re: Migrating to AS7
              Prasad Deshpande Expert

              MyApp.jar contains some classes (one of them is MyClass) which are used by my EJBs.

               

              I can't remove the library.

              If you move MyApp.jar in EAR/lib directory, it will still be available to your EJB's so there won't be any problem there. I'm asking to remove subdeployment node for MyApp.jar in your jboss-deployment-structure.xml. Cause after moving that jar to EAR/lib directory, it doesn't make sense to define it as subdeployment module.