Previous Topic: Troubleshoot Issues Related to Protected Web Services Making Use of Apache Commons Logging and Log4j

Next Topic: log4j Class Loading Problem

Commons Logging Classl Loading Problem

Symptom:

The SOA Agent for WebLogic uses the Apache Commons Logging package as part of its logging implementation. Class loading conflicts can occur when the SOA Agent is configured to protect web services that also use Commons Logging if the web service and SOA Agent are not using the same version of Commons Logging.

If such a class loading conflict is occurring, WebLogic may log an error output similar to the following during initialization:

<Sep 16, 2009 9:15:54 AM EDT> <Error> <HTTP> <BEA-101216> <Servlet: "ServicesServlethttp"
failed to preload on startup in Web application: "XXXXXX.war".
java.lang.ExceptionInInitializerError
….
org.apache.commons.logging.LogConfigurationException: org.apache.commons.logging.LogConfig
urationException: org.apache.commons.logging.LogConfigurationException: Invalid class loader hierarchy.  You have more than one version of 'org.apache.commons.logging.Log' visible, which is not allowed. (Caused by org.apache.commons.logging.LogConfigurationException: Invalid class loader hierarchy.  You have more than one version of 'org.apache.commons.logging.Log' visible, which is not allowed.) (Caused by org.apache.commons.logging.LogConfigurationException: org.apache.commons.logging.LogConfigurationException: Invalid class loader hierarchy.  You have more than one version of 'org.apache.commons.logging.Log' visible, which is not allowed. (Caused by org.apache.commons.logging.LogConfigurationException: Invalid class loader hierarchy.  You have more than one version of 'org.apache.commons.logging.Log' visible, which is not allowed.))
        at org.apache.commons.logging.impl.LogFactoryImpl.newInstance(LogFactoryImpl.java:543)
….

Solution:

To remove class loading conflicts between the SOA Agent and protected web service, verify that the web service uses the same version of the Apache Commons Logging jar file (commons-logging.jar) as the SOA Agent (version 1.1.1). If the web service is not using the same version, replace the commons-logging.jar used by the web service with the 1.1.1 version.