My Oracle Support Banner

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

Last updated on APRIL 13, 2021

Applies to:

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


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].




To view full details, sign in with your My Oracle Support account.

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

In this Document

My Oracle Support provides customers with access to over a million knowledge articles and a vibrant support community of peers and Oracle experts.