Tag Archives: Class path contains multiple SLF4J bindings error

Log jar package conflict error: Class path contains multiple SLF4J bindings

Description of the problem: Tomcat is stuck at startup, and the error log is as follows: 

November 07, 2017 8:35:45 PM org.apache.catalina.core.ApplicationContext log
Information: Initializing Spring root WebApplicationContext
SLF4J: Class path contains multiple SLF4J bindings.
SLF4J: Found binding in [jar:file: /E:/workspace/.metadata/.plugins/org.eclipse.wst.server.core/tmp0/wtpwebapps/wlf-notify/WEB-INF/lib/log4j-slf4j- impl-2.9.1.jar!/org/slf4j/impl/StaticLoggerBinder. class ]
SLF4J: Found binding in [jar:file: /E:/workspace/.metadata/.plugins/org.eclipse.wst.server.core/tmp0/wtpwebapps/wlf-notify/WEB-INF/lib/slf4j-log4j12- 1.7.2.jar!/org/slf4j/impl/StaticLoggerBinder. class ]
SLF4J: See http: // www.slf4j.org/codes.html#multiple_bindings for an explanation. 
SLF4J: Actual binding is of type [org.apache.logging.slf4j.Log4jLoggerFactory]

  Problem location: From the log, I see that the two log jar packages conflict: log4j-slf4j-impl-2.9.1.jar and slf4j-log4j12-1.7.2.jar   

  Solve the problem:

  1. Simple solution: According to the local tomcat path given in the log, enter the lib, delete one of them, and enter E:/workspace/.metadata/.plugins/org.eclipse.wst.server.core/tmp0/wtpwebapps/ wlf-notify/WEB-INF/lib, delete log4j-slf4j-impl-2.9.1.jar, and restart.

  2. The fundamental solution: through maven’s dependency tree analysis, and then through execluse to eliminate conflicting dependencies in pom.xml.