2016-07-04 92 views
3

我在我的maven項目中使用帶有log4j的SLF4J。當我在eclipse中的tomcat中運行項目時,以及在使用tomcat maven插件的maven中一切正常。log4j-over-slf4j.jar和slf4j-log4j12.jar conflitct ...但我沒有log4j-over-slf4j

但是當我把戰爭放在我的tomcat生產服務器上時,項目不啓動,給我這個錯誤。

java.lang.IllegalStateException:檢測到的類路徑上都log4j的環比slf4j.jar 和約束SLF4J-log4j12.jar,搶佔 的StackOverflowError。有關更多詳細信息,另請參閱 http://www.slf4j.org/codes.html#log4jDelegationLoop

我已經看到了很多關於這個錯誤的stackoverflow的答案,我已經明白我需要排除衝突的jar。問題是我沒有log4j-over-slf4j在我的項目中... .war的lib文件夾不包含這個jar,並且問題僅在我的生產服務器的tomcat服務器中存在。我不知道該怎麼辦。我在這裏放置我的依賴樹。

[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 

編輯:

經過很多很多很多其他的測試,這個問題只與我的生產服務器的tomcat發生,我部署在其他8臺服務器和系統運行正常。我想這是與我的生產服務器tomcat中運行的其他項目的衝突。可以這樣做嗎?

+0

您是否檢查過tomcat/lib文件夾中的log4j-over-slf4j.jar? – DiogoSantana

+0

非常感謝你@DiogoSantana,你的小費解決了我的問題。這個lib是在tomcat的lib文件夾中,它來自很老的項目。 –

回答

1

你應該在tomcat/lib文件夾中有一個log4j-over-slf4j.jar。你檢查過了嗎?

+0

非常感謝你@DiogoSantana,你的小費解決了我的問題。這個lib是在tomcat的lib文件夾中,它來自很老的項目。 –

相關問題