Java – Weblogic EJB deployement: classes in jar inside ear are not accessible

deploymentejbjakarta-eejavaweblogic

I'm trying to deploy an ear containing an ejb application into a weblogic 9.2 server.

This ear is created using maven (itself using the ear ant task). Maven produces the following structure:

myApp.ear
 - META-INF
   - application
   - MANIFEST.MF
 - dependency-1.jar
 - dependency-2.jar
 - ...
 - dependency-n.jar
 - myEjb.jar

The manifest contains a Class Path section that is looking good (all dependencies jar are listed)

When I try to deploy the ear I get a NoClassDefFoundError exception.

If I put all my jars in the lib dir of my domain, the ear is successfully deployed.

If I put all my jars in a dir called APP-INF/lib (the weblogic standard), the ear is successfully deployed too.

myApp.ear
 - META-INF
   - application
   - MANIFEST.MF
 - APP-INF
   - lib
     - dependency-1.jar
     - dependency-2.jar
     - ...
     - dependency-n.jar
 - myEjb.jar

In the same project, I have others ears that does not use the APP-INF/lib dir that are working perfectly.

Does someone has an idea of why weblogic is not able to deploy my ear ?


After some investigation I've found the problem source: it was the manifest class-path of the myEjb.jar module. See comment in accepted response.

Thanks a lot.

Best Answer

The standard approach for dependency jars within an EAR is to put them in the APP-INF/lib as given on the documentation

http://download.oracle.com/docs/cd/E13222_01/wls/docs81/programming/environment.html#1099434

I suspect the problem in your first EAR is in the actual classpath entries in your Manifest.mf

see the Manifest Class-Path section on http://download.oracle.com/docs/cd/E12840_01/wls/docs103/programming/classloading.html#wp1065667

The manifest Class-Path entries refer to other archives relative to the current archive in which these entries are defined

Are there any sub-directories or relative path incorrect?

Related Topic