Gwt + jetty + spring + log4j ERROR: "DOMConfigurator object is not assigned to the configurator"

This problem was mentioned in several sources on the Internet, but I could not solve it using the solutions provided there.

PROBLEM: The following error is issued from log4j when mvn gwt: run is released :

[ERROR] log4j:ERROR A "org.apache.log4j.xml.DOMConfigurator" object is not assignable to a "org.apache.log4j.spi.Configurator" variable.
[ERROR] log4j:ERROR The class "org.apache.log4j.spi.Configurator" was loaded by
[ERROR] log4j:ERROR [sun.misc.Launcher$AppClassLoader@23137792] whereas object of type
[ERROR] log4j:ERROR "org.apache.log4j.xml.DOMConfigurator" was loaded by [WebAppClassLoader=Demo@3d1665ac].
[ERROR] log4j:ERROR Could not instantiate configurator [org.apache.log4j.xml.DOMConfigurator].

DESCRIPTION OF MY PROJECT: I use the default touchdown server provided with gwt and run it in an explosive war.

<gwt.version>2.6.1</gwt.version>
<spring.version>3.2.6.RELEASE</spring.version>
<log4j.version>1.2.17</log4j.version>
<slf4j.version>1.7.5</slf4j.version>

<dependency>
    <groupId>log4j</groupId>
    <artifactId>log4j</artifactId>
    <version>${log4j.version}</version>
</dependency>
<dependency>
    <groupId>org.slf4j</groupId>
    <artifactId>slf4j-api</artifactId>
    <scope>runtime</scope>
</dependency>
<dependency>
    <groupId>org.slf4j</groupId>
    <artifactId>slf4j-log4j12</artifactId>
    <scope>runtime</scope>
</dependency>
<!-- Normally this jar would be listed in dependencies but in my case causes log4j ERROR. -->
<dependency>
    <groupId>org.slf4j</groupId>
    <artifactId>jcl-over-slf4j</artifactId>
    <version>${slf4j.version}</version>
    <scope>runtime</scope>
</dependency>

What more, I exclude commons-logging from spring and other projects that depend on it.

( ) : , WEB-INF/lib log4j, slf4j-api, slf4j-log4j12 jcl-over-slf4j, , jcl-over-slf4 (.. ).

jcl-overl-slf4j maven (. ), lib, . . lib, , . maven-dependency-plugin , lib maven.

, , , - log4j, slf4j-api, slf4j-log4j12, jcl-over-slf4j - gwt spring.

, jcl-over-slf4j maven?

+4
1

Jetty org.apache.commons.logging , .. (.. ) webapp WEB-INF/lib. org.apache.commons.logging jcl-over-slf4j. , webapp Commons Logging, , , , SLF4J ( ), , , slf4j-log4j12 log4j . webapp Log4j (, SLF4J) , JAR webapp WEB-INF/lib ( ). , , , .

, : .

, DevMode - (. https://docs.google.com/document/d/1bWfafaPA0m0Z1Swodnx7m3QTv31OdqFkE7aeadN_2BU/edit?usp=sharing, ).

, ServletContainerLauncher DevMode , webapp (, mvn jetty:run mvn tomcat7:run)). DevMode -noserver.

, , SuperDevMode; SuperDevMode DevMode (DevMode Firefox, Chrome Linux - , Linux, Chrome , : Explorer Windows).

+4

Source: https://habr.com/ru/post/1543726/


All Articles