Shouldn't external jars be places in a lib directory within the EAR? You can override it in application.xml, but this is the default.
posted 10 years ago
You have to have this log4j jar in the APP-INF\lib folder of the ear archive for your requirement.
You don't have to specify anything in the manifest.mf file.
To get a hang on this, please read the j2ee classloaders functioning.
for e.g. When a class in war archive gets loaded, the web classloader starts locating other depending class files. The search is delegated to the parent i.e. ear class loader. This ear class loader delegates to the system classloader and the system classloader delegates to the bootstrap class loader.
The bootstrap classloader tries to find the requested class definition in the java/ext/lib or in the bootstrap path. If it is unsuccessfull then the request is handled by the system classloader which hunts for the class in the system classpath variable. If this also fails, the request is handled by the ear classloader, which looks for the class in the APP-INF/lib. If this also fails, the web classloader looks into the web-inf/lib folder.
If it is not found anywhere, you get NoClassDefFoundError.
You can't wake a person who is <b><i>pretending</i></b> to be asleep.<br />Like what <b>"it"</b> does not like - <i> Gurdjieff </i>
the log4j jar file is being used by both my web and ejb archieve.
can you tell me where should i put the log4j jar file.
since putting in web-inf/lib does not work...........
posted 10 years ago
Hi, you should not put it in WEB-INF/lib. You do it in your EAR/lib directory, so that the structure is similar to this:
So, the lib directory that contains the shared jars should be put on the same level as you put the modules. Note, that you may change the default "lib" directory using the <library-directory> element, which is a child of the <application> element in application.xml file. This is the standard JavaEE way to include shared libraries. Cheers. [ December 10, 2008: Message edited by: Raf Szczypiorski ]