General J2EE: How to make a util.jar available to all classes in an EAR?

  1. I'm deploying our EJBs in an exploded EAR. All of them need log4j.jar, as well as a couple other utility JAR files. Is there a way, through an EAR-level MANIFEST.MF file or a lib directory, to make these JARs available to all of our EJBs? I'm trying to avoic adding MANIFEST.MF Class-Path entries to each of the individual EJB JARs.


  2. If you don't plan on changing the jars too often - you could put them in the CLASSPATH and they would be available to all EAR files then

  3. Actually it may not work because many AppServers don't use CLASSPATH, they use internal one.
  4. If the util.jar consists of any User classes which will be used by the EJB's deployed, then u have to set in the MANIFEST file,
    or place the util.jar in the $jboss..../lib/ext/ in this directory.

  5. We ran into this exact problem ourselves with our application running on Weblogic. The way we solved it was to create a "jarLoader" EJB whose only reason for existing was to utilize its Class-Path property in the MANIFEST.MF file. We specified the jarLoader to be the first EJB that would be loaded when the app server started up, and thus all EJBs would automatically have access to its referenced jars.