2 Replies Latest reply on Feb 24, 2012 1:43 AM by ablet

    ClassNotFoundException though module dependency is defined

    ablet

      Hi,

       

      I have migrated a project from Jboss 4.3 to Jboss 7.1.0.CR1b. The deployed application is an ear file including over 80 ejb-jars. For ease of the work all the project libraries were included in the ear/lib folder and the whole application is deployed successfully and some functions are tested and is working perfectly.

       

      for the next step, i wanted to take  the all libraries (over 150 jars) out of the ear file. I already defined a module and included all the library jar files as the resources of that module and defined the dependecy in the jboss-deployment-structure.xml.

       

      While I am sure that Jboss recognizes many of the APIs through module dependecy difintion, still I get many ClassNotFoundException, mostly during runtime.

       

      Each time i have to search to see which jar files it might depends on and as soon as I add that jar file to the ear/lib the exception will be resolved.

       

      I already spend a whole day to resolve these eceptions but it seems finding dependecy one by one is a hectic and very timeconsuming task. ...I reckon this is due to inconsistency with default jboss 7 class loading... Is there any way to tell jboss to give priority to the my defined module or to define a lib folder outside of ear file and tell jboss to take out libraries from there?

       

       

      you help is very appreciated...

        • 1. Re: ClassNotFoundException though module dependency is defined
          ctomc

          Hi,

           

          when you defined your own module, did you include all "provided" dependencies in module.xml so all dependencies of your module resources are included.

          app server automatically adds some dependencies to your application based on what technologies you use (if you use jpa it will add javax.persistence module).

           

          --

          tomaz

          • 2. Re: ClassNotFoundException though module dependency is defined
            ablet

            Thanks Tomaz, It was a great help.

             

            I added following dependencies so far to my own module.xml  and many ClassNotFoundExceptions are resolved:

             

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

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

             

            I should now look for other dependencies that are missing.