一、問題
Failed to load class “org.slf4j.impl.StaticLoggerBinder”.
二、問題分析
slf4j是日誌打印的工具類,只在pom.xml中添加了依賴配置。錯誤說是加載“org.slf4j.impl.StaticLoggerBinder”失敗,翻閱官網找到問題描述:
This error is reported when the org.slf4j.impl.StaticLoggerBinder class could not be loaded into memory. This happens when no appropriate SLF4J binding could be found on the class path. Placing one (and only one) of slf4j-nop.jar, slf4j-simple.jar, slf4j-log4j12.jar, slf4j-jdk14.jar or logback-classic.jar on the class path should solve the problem.
簡單的說就是沒有slf4j-nop.jar的jar.
三、問題解決
添加slf4j-nop.jar依賴:
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-nop</artifactId>
<version>1.6.1</version>
</dependency>
具體版本後,請根據自己項目的依賴版本而定,保持一致!