log4j-over-slf4j.jar and slf4j-log4j12.jar conflitct… but i don’t have log4j-over-slf4j

I use SLF4J with log4j in my maven project. Everything is ok when i running the project in tomcat in eclipse, and in maven with tomcat maven plugin.

But when i put the war in my tomcat production server, the project don’t start, giving me this error.

java.lang.IllegalStateException: Detected both log4j-over-slf4j.jar AND bound slf4j-log4j12.jar on the class path, preempting StackOverflowError. See also http://www.slf4j.org/codes.html#log4jDelegationLoop for more details.

I already saw many answers in stackoverflow about this error and i already understood i need to exclude the conflict jar. The problem is i don’t have log4j-over-slf4j in my project… The lib folder of the .war don’t contain this jar and the problem only hapens in tomcat server of my production server. I don’t know what to do. I’m putting here my dependency tree.

[INFO] +- junit:junit:jar:4.12:test
[INFO] |  - org.hamcrest:hamcrest-core:jar:1.3:test
[INFO] +- com.sun.faces:jsf-api:jar:2.2.13:compile
[INFO] +- com.sun.faces:jsf-impl:jar:2.2.13:compile
[INFO] +- javax.servlet:jstl:jar:1.2:compile
[INFO] +- org.hibernate:hibernate-entitymanager:jar:5.1.0.Final:compile
[INFO] |  +- org.jboss.logging:jboss-logging:jar:3.3.0.Final:compile
[INFO] |  +- org.hibernate:hibernate-core:jar:5.1.0.Final:compile
[INFO] |  |  +- (org.jboss.logging:jboss-logging:jar:3.3.0.Final:compile - omitted for duplicate)
[INFO] |  |  +- (org.hibernate.javax.persistence:hibernate-jpa-2.1-api:jar:1.0.0.Final:compile - omitted for duplicate)
[INFO] |  |  +- (org.javassist:javassist:jar:3.20.0-GA:compile - omitted for duplicate)
[INFO] |  |  +- antlr:antlr:jar:2.7.7:compile
[INFO] |  |  +- (org.apache.geronimo.specs:geronimo-jta_1.1_spec:jar:1.1.1:compile - omitted for duplicate)
[INFO] |  |  +- org.jboss:jandex:jar:2.0.0.Final:compile
[INFO] |  |  +- (com.fasterxml:classmate:jar:1.3.0:compile - omitted for conflict with 1.1.0)
[INFO] |  |  +- (dom4j:dom4j:jar:1.6.1:compile - omitted for duplicate)
[INFO] |  |  - (org.hibernate.common:hibernate-commons-annotations:jar:5.0.1.Final:compile - omitted for duplicate)
[INFO] |  +- dom4j:dom4j:jar:1.6.1:compile
[INFO] |  |  - (xml-apis:xml-apis:jar:1.0.b2:compile - omitted for conflict with 1.4.01)
[INFO] |  +- org.hibernate.common:hibernate-commons-annotations:jar:5.0.1.Final:compile
[INFO] |  |  - (org.jboss.logging:jboss-logging:jar:3.3.0.Final:compile - omitted for duplicate)
[INFO] |  +- org.hibernate.javax.persistence:hibernate-jpa-2.1-api:jar:1.0.0.Final:compile
[INFO] |  +- org.javassist:javassist:jar:3.20.0-GA:compile
[INFO] |  - org.apache.geronimo.specs:geronimo-jta_1.1_spec:jar:1.1.1:compile
[INFO] +- org.hibernate:hibernate-validator:jar:5.2.4.Final:compile
[INFO] |  +- javax.validation:validation-api:jar:1.1.0.Final:compile
[INFO] |  +- (org.jboss.logging:jboss-logging:jar:3.2.1.Final:compile - omitted for conflict with 3.3.0.Final)
[INFO] |  - com.fasterxml:classmate:jar:1.1.0:compile
[INFO] +- org.slf4j:slf4j-log4j12:jar:1.7.21:compile
[INFO] |  +- org.slf4j:slf4j-api:jar:1.7.21:compile
[INFO] |  - log4j:log4j:jar:1.2.17:compile
[INFO] +- log4j:apache-log4j-extras:jar:1.2.17:compile
[INFO] |  - (log4j:log4j:jar:1.2.17:compile - omitted for duplicate)
[INFO] +- javax.servlet:javax.servlet-api:jar:3.0.1:provided
[INFO] +- org.postgresql:postgresql:jar:9.4.1208.jre7:compile
[INFO] +- org.primefaces:primefaces:jar:6.0:compile
[INFO] +- org.primefaces.themes:start:jar:1.0.10:compile
[INFO] +- commons-io:commons-io:jar:2.5:compile
[INFO] +- org.jxls:jxls-reader:jar:2.0.2:compile
[INFO] |  +- org.apache.commons:commons-digester3:jar:with-deps:3.2:compile
[INFO] |  |  +- cglib:cglib:jar:2.2.2:compile
[INFO] |  |  |  - asm:asm:jar:3.3.1:compile
[INFO] |  |  +- commons-beanutils:commons-beanutils:jar:1.8.3:compile
[INFO] |  |  |  - (commons-logging:commons-logging:jar:1.1.1:compile - omitted for duplicate)
[INFO] |  |  - (commons-logging:commons-logging:jar:1.1.1:compile - omitted for conflict with 1.2)
[INFO] |  +- org.apache.commons:commons-jexl:jar:2.1.1:compile
[INFO] |  |  - (commons-logging:commons-logging:jar:1.1.1:compile - omitted for duplicate)
[INFO] |  +- org.apache.poi:poi:jar:3.12:compile
[INFO] |  |  - (commons-codec:commons-codec:jar:1.9:compile - omitted for conflict with 1.10)
[INFO] |  +- org.apache.poi:poi-ooxml:jar:3.12:compile
[INFO] |  |  +- (org.apache.poi:poi:jar:3.12:compile - omitted for duplicate)
[INFO] |  |  - org.apache.poi:poi-ooxml-schemas:jar:3.12:compile
[INFO] |  |     - org.apache.xmlbeans:xmlbeans:jar:2.6.0:compile
[INFO] |  |        - stax:stax-api:jar:1.0.1:compile
[INFO] |  +- (org.slf4j:slf4j-api:jar:1.7.12:compile - omitted for conflict with 1.7.21)
[INFO] |  - org.slf4j:jcl-over-slf4j:jar:1.7.12:compile
[INFO] |     - (org.slf4j:slf4j-api:jar:1.7.12:compile - omitted for conflict with 1.7.21)
[INFO] +- org.jsoup:jsoup:jar:1.9.2:compile
[INFO] +- net.sourceforge.htmlunit:htmlunit:jar:2.22:compile
[INFO] |  +- xalan:xalan:jar:2.7.2:compile
[INFO] |  |  - xalan:serializer:jar:2.7.2:compile
[INFO] |  +- org.apache.commons:commons-lang3:jar:3.4:compile
[INFO] |  +- org.apache.httpcomponents:httpclient:jar:4.5.2:compile
[INFO] |  |  +- org.apache.httpcomponents:httpcore:jar:4.4.4:compile
[INFO] |  |  +- (commons-logging:commons-logging:jar:1.2:compile - omitted for conflict with 1.1.1)
[INFO] |  |  - (commons-codec:commons-codec:jar:1.9:compile - omitted for duplicate)
[INFO] |  +- org.apache.httpcomponents:httpmime:jar:4.5.2:compile
[INFO] |  |  - (org.apache.httpcomponents:httpclient:jar:4.5.2:compile - omitted for duplicate)
[INFO] |  +- commons-codec:commons-codec:jar:1.10:compile
[INFO] |  +- net.sourceforge.htmlunit:htmlunit-core-js:jar:2.22:compile
[INFO] |  +- net.sourceforge.htmlunit:neko-htmlunit:jar:2.21:compile
[INFO] |  |  - xerces:xercesImpl:jar:2.11.0:compile
[INFO] |  |     - (xml-apis:xml-apis:jar:1.4.01:compile - omitted for conflict with 1.0.b2)
[INFO] |  +- net.sourceforge.cssparser:cssparser:jar:0.9.19:compile
[INFO] |  |  - org.w3c.css:sac:jar:1.3:compile
[INFO] |  +- (commons-io:commons-io:jar:2.5:compile - omitted for duplicate)
[INFO] |  +- commons-logging:commons-logging:jar:1.2:compile
[INFO] |  - org.eclipse.jetty.websocket:websocket-client:jar:9.2.17.v20160517:compile
[INFO] |     +- org.eclipse.jetty:jetty-util:jar:9.2.17.v20160517:compile
[INFO] |     +- org.eclipse.jetty:jetty-io:jar:9.2.17.v20160517:compile
[INFO] |     |  - (org.eclipse.jetty:jetty-util:jar:9.2.17.v20160517:compile - omitted for duplicate)
[INFO] |     - org.eclipse.jetty.websocket:websocket-common:jar:9.2.17.v20160517:compile
[INFO] |        +- org.eclipse.jetty.websocket:websocket-api:jar:9.2.17.v20160517:compile
[INFO] |        +- (org.eclipse.jetty:jetty-util:jar:9.2.17.v20160517:compile - omitted for duplicate)
[INFO] |        - (org.eclipse.jetty:jetty-io:jar:9.2.17.v20160517:compile - omitted for duplicate)
[INFO] - xml-apis:xml-apis:jar:1.4.01:compile 

EDIT :

After many many many other tests, this problem only happens with my production server tomcat, i deployed in other 8 servers and the system runs ok. I suppose it’s a conflict with other projects running in my production server tomcat. Can be this possible?

Answer

You should have a log4j-over-slf4j.jar in tomcat/lib folder. Have you checked it?

Leave a Reply

Your email address will not be published. Required fields are marked *