tags:

views:

948

answers:

3

I need to add log4j jar in classpath of WAS server but I am unable to put it. Please suggest. I tried to add this jar in start script of WAS server.

A: 

From the Admin console, select Environment->Shared Libraries

Then in the page displayed, select New and follow the directions to add you library.

Robin
Robin,Creating the shared library does not do anything. You need to associate the shared library with the application or with the application server (via a classloader) for it to be part of the run-time.
Manglu
A: 

It depends why you want to add it. Do you need access to log4j from within your applications, if so you can add it into the application (i.e. in the WEB-INF/lib directory), if you are writing a component that needs to run within the WebSphere runtime (i.e. a JMX library) then you can put it into WebSphere/AppServer/lib/ext.

Michael Ransley
+1  A: 

Hi,

As Michael Ransley mentioned, you need to determine who needs log4j. If it is a web application, then WEB-INF/lib is the best location.

If it used by EJB components then place the log4j as a utility jar in the EAR.

Alternatively, create a Shared Library and associate the shared library to your application.

Another choice would be to associate the shared library to your server (instead of the application) in which case, it becomes available to all the applications that are running on that server.

Storing in the App Server lib/ext or the other base classpath(s) is usually a bad idea. The reason is this could cause conflicts (log4j does not cause conflicts but other Jars could likely cause conflicts) and might prevent the application server from even starting up.

Also remember, depending on where the log4j.jar is kept (or associated via shared libraries) different class loaders would be picking up this JAR file.

Manglu