1

I was working in web application. I tried removing the jar duplication from my war with WEB-INF/lib/*.jar. This helped me in excluding the jar from my war. While deploying the ear in websphere i have the follwing issue,

I have checked my war class path it contains the log4j.jar and common-logging1.1.jar.

Kindly help!!!

Error log:

[7/6/12 22:34:10:577 CEST] 00000165 webapp        E com.ibm.ws.webcontainer.webapp.WebApp notifyServletContextCreated SRVE0283E: Exception caught while initializing context: {0}
    org.apache.commons.logging.LogConfigurationException: User-specified log class 'org.apache.commons.logging.impl.Log4JLogger' cannot be found or is not useable.
    at org.apache.commons.logging.impl.LogFactoryImpl.discoverLogImplementation(LogFactoryImpl.java:874)
    at org.apache.commons.logging.impl.LogFactoryImpl.newInstance(LogFactoryImpl.java:604)
    at org.apache.commons.logging.impl.LogFactoryImpl.getInstance(LogFactoryImpl.java:336)
    at org.apache.commons.logging.impl.LogFactoryImpl.getInstance(LogFactoryImpl.java:310)
cringe
  • 13,401
  • 15
  • 69
  • 102
Arundevi
  • 11
  • 1
  • 2
  • My guess would be that this is a product defect. Unfortunately, you've truncated the stack a bit too much, so it's hard to match against existing APARs. – Brett Kail Jul 09 '12 at 15:22

1 Answers1

2

WebSphere 6.1 includes Commmons Logging itself, loaded by a higher classloader than your web application. (You can see where the JCL classes are loaded from by deploying this JSP to your application and typing in one the JCL class names.) So you've got JCL configured to load log4j classes, but the higher level (parent) classloader can't see the log4j classes from your lower level web application classloader.

So one solution, particularly if you require the 1.1 version of JCL rather than WebSphere's included version (1.0), is to change your WebSphere classloader policy to parent last.

Since changing the classloader policy can have other effects, another option is to use WebSphere's included version and use a technique to tell it to use log4j as the logging mechanism within your application. But note that since WebSphere 6.1 doesn't include the entire JCL1.0, you'll then need to deploy a full JCL 1.0 with your application.

Community
  • 1
  • 1
dbreaux
  • 4,982
  • 1
  • 25
  • 64