Log4j Initialization Error in WebServices Deploy With prefer-web-inf-classes=true (Doc ID 2266334.1)

Last updated on MAY 18, 2017

Applies to:

Oracle WebLogic Server - Version 12.1.2.0.0 to 12.2.1.2.0 [Release 12c]
Information in this document applies to any platform.

Symptoms

Apache log4j initialization error is generated when WebServices is deployed and initialized.

When log4j.jar is existing in both the system classpath and WEB-INF/lib, and prefer-web-inf-classes is true in weblogic.xml.

Classes in log4j.jar should be loaded from WEB-INF/lib but it is loaded from system classpath when WebServices is deployed. Then the following log4j error is logged.

log4j:ERROR A "org.apache.log4j.xml.DOMConfigurator" object is not assignable to a "org.apache.log4j.spi.Configurator" variable.
log4j:ERROR The class "org.apache.log4j.spi.Configurator" was loaded by
log4j:ERROR [weblogic.utils.classloaders.ChangeAwareClassLoader@1101154 finder: weblogic.utils.classloaders.CodeGenClassFinder@745d25 annotation: testcase3_log4j@testcase3_log4j] whereas object of type
log4j:ERROR "org.apache.log4j.xml.DOMConfigurator" was loaded by [sun.misc.Launcher$AppClassLoader@1a462c9].
log4j:ERROR Could not instantiate configurator [org.apache.log4j.xml.DOMConfigurator].

 

 

Changes

 

Cause

Sign In with your My Oracle Support account

Don't have a My Oracle Support account? Click to get started

My Oracle Support provides customers with access to over a
Million Knowledge Articles and hundreds of Community platforms