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)
1
  • 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. Commented Jul 9, 2012 at 15:22

1 Answer 1

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.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.