1

JBoss AS7 Developer Guide mentions the following classloading preference from a higher priority to lower priority:

1. System Dependencies - These are dependencies that are added to the module automatically by the container, including the Java EE api's.
2. User Dependencies - These are dependencies that are added through jboss-deployment-structure.xml or through the Dependencies: manifest entry.
3. Local Resource - Class files packaged up inside the deployment itself, e.g. class files from WEB-INF/classes or WEB-INF/lib of a war.
4. Inter deployment dependencies - These are dependencies on other deployments in an ear deployment. This can include classes in an ear's lib directory, or classes defined in other ejb jars. 

However, I do not understand the DIFFERENCE between #2 and #3. What kind of dependencies could be classified under category 2 above vs category 3. To me, they look the same.

As an example of migrating my Spring application from JBoss 4 to JBoss 7, I encountered a NoClassDefError for quartz 1.6 jar that our application had been using. The quartz 1.6 jar is right inside the WEB-INF/lib folder of my application. This means it correctly falls under Category 3 above. But most articles on web indicate that I have to put it in either as a JBoss 7 module or define it in the jboss-deployment-structure.xml. Why ???

I have also read the migration guidelines and did the TattleTale exercise as pointed in those guidelines. But don't quite get it on what do I do with the report? I read the answer to this Best Practice for loading 3rd party JARs in JBoss AS7 standalone deployment? - looks like quite some amount of effort will be required for the migration. Does not seem like a quick trivial task considering the numerous dependencies an application can easily have. Can someone please confirm this?

I guess I need a guideline about

  1. For which jars do I create a module.xml? (Possible candidates - Spring, Quartz, Apache , C3P0 connection pools etc) ???

  2. For which jars do I have a jboss-deployment-structure.xml? (What could be good candidates here?)

  3. For which jars do I leave them in web-inf/lib folder? (Application uses certain specialized math libraries - like colt.jar, excel graphing libraries like - jxls.jar, poi.jar - these seem like good candidates here).

Community
  • 1
  • 1

1 Answers1

0

JBoss AS releases used to manage their set of libraries in different ways. Earlier, Release 4.x was used to define the core server libraries into the JBOSS_HOME/server libraries. Thereafter, each server definition had its specific library into the server//lib folder.

JBoss AS 7 follows a real modular approach deprecating all earlier approaches. The server bootstrap libraries are now located at the root of the application server. There you can find the jboss-modules.jar archive, which is all you need to bootstrap the new application server kernel, based on the JBoss modules.

For which jars do I create a module.xml? (Possible candidates - Spring, Quartz, Apache , C3P0 connection pools etc) ???

If there are any dependency jars those could be created as modules and define in the module.xml. Also you need to defined the dependencies of the define library.

ex.

<?xml version="1.0" encoding="UTF-8"?>
<module xmlns="urn:jboss:module:1.1" name="rezg.rezg-dto">
    <dependencies>
        <module name="org.apache.log4j" />
    </dependencies>
   <resources>
       <resource-root path="rezg-dto-1.0.0.jar"/>
   </resources>
</module>

Connection pool can be configured as a module and the procedure for installing a new module requires copying the .jar libraries in the appropriate modules path and adding a module.xml file, which declares the module and its dependencies.

For which jars do I have a jboss-deployment-structure.xml? (What could be good candidates here?)

All the dependency jars should be defined in here. Also you can define either in the MANIFEST.MF or standalone.xml.

For which jars do I leave them in web-inf/lib folder? (Application uses certain specialized math libraries - like colt.jar, excel graphing libraries like - jxls.jar, poi.jar - these seem like good candidates here).

If there are any jars which is used only in your ear or war then those could be defined in WEB-INF/lib. However, it is recommend to use as modules.

kds
  • 28,155
  • 9
  • 38
  • 55