天天看點

jar沖突問題:MVN package 時 SLF4J: Class path contains multiple SLF4J bindings 錯誤解決辦法

編譯通過,打包時報如下錯誤 :

19-Aug-2018 10:53:56.961 INFO [localhost-startStop-1] org.apache.jasper.servlet.TldScanner.scanJars At least one JAR was scanned for TLDs yet contained no TLDs. Enable debug logging for this logger for a complete list of JARs that were scanned but no TLDs were found in them. Skipping unneeded JARs during scanning can improve startup time and JSP compilation time.

SLF4J: The requested version 1.7.16 by your slf4j binding is not compatible with [1.5.5, 1.5.6, 1.5.7, 1.5.8, 1.5.9, 1.5.10]

SLF4J: See http://www.slf4j.org/codes.html#version_mismatch for further details.

SLF4J: Class path contains multiple SLF4J bindings.

SLF4J: Found binding in [jar:file:/home/baseuser/apache-tomcat-8.5.3/webapps/ROOT/WEB-INF/lib/logback-classic-1.1.11.jar!/org/slf4j/impl/StaticLoggerBinder.class]

SLF4J: Found binding in [jar:file:/home/baseuser/apache-tomcat-8.5.3/webapps/ROOT/WEB-INF/lib/slf4j-log4j12-1.5.10.jar!/org/slf4j/impl/StaticLoggerBinder.class]

SLF4J: See http://www.slf4j.org/codes.html#multiple_bindings for an explanation.

19-Aug-2018 10:53:57.061 SEVERE [localhost-startStop-1] org.apache.catalina.core.StandardContext.startInternal One or more listeners failed to start. Full details will be found in the appropriate container log file

19-Aug-2018 10:53:57.065 SEVERE [localhost-startStop-1] org.apache.catalina.core.StandardContext.startInternal Context [] startup failed due to previous errors

在工程目錄下用     mvn dependency:tree -P profile > dependency.txt  把工程的依賴關系導出為檔案,

在檔案中查找對slf4J和log4j庫的依賴關系,把它排除掉不打包即可。