轉自:https://blog.csdn.net/qqqqqq654/article/details/53432244
剛開始學用idea,上學時Java學的也不是很好,就用了HelloWorld測試軟件(菜/笑哭),竟然出現了“Failed to load class "org.slf4j.impl.StaticLoggerBinder”這種錯誤,只好百度,得到如下解決方式:(我下載的是slf4j-nop-1.6.2,竟然比博主給出的版本還低了(笑哭)。下載地址是:http://www.java2s.com/Code/Jar/s/Downloadslf4jnop162jar.htm)
在hibernate的編程中,有的時候明明項目看着沒有問題,但是一運行起來就會報錯,比如說如下所示的問題故障代碼:
SLF4J: Failed to load class "org.slf4j.impl.StaticLoggerBinder".
SLF4J: See http://www.slf4j.org/codes.html#StaticLoggerBinder for further details.
由此我們可以看出,報出錯誤的地方主要是slf4j的jar包,而故障碼中“Failed to load class ’org.slf4j.impl.StaticLoggerBinder‘”的意思則是“加載類文件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.
翻譯過來如下所示:
這個錯誤是當org.slf4j.impl報道。StaticLoggerBinder類不能被加載到內存中。發生這種情況時,無法找到合適的SLF4J綁定類路徑。slf4j-nop放置一個(且只有一個)。slf4j-simple jar。slf4j-log4j12 jar。slf4j-jdk14 jar。jar或logback-classic。jar的類路徑應該解決這個問題。
所以說解決的辦法就是隨便下載一個上述的包文件之一就行了(且只有一個),此時我下載的是“slf4j-nop-1.6.4.jar”包文件,直接將其加載到自己的項目中然后整個項目就可以編譯通過了。