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.
Originally posted by Rajah Nagur: You have to have this log4j jar in the APP-INF\lib folder of the ear archive for your requirement.
The APP-INF folder is specific to some server (not sure which) and is not a standard.
As suggested by Raf, the common jars go in the lib folder of the EAR:
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.
Joined: Apr 23, 2006
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...........
Joined: Aug 21, 2008
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 ]