1. 程式人生 > >Failed to load class "org.slf4j.impl.StaticLoggerBinder問題故障的解決

Failed to load class "org.slf4j.impl.StaticLoggerBinder問題故障的解決

在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”包檔案,直接將其載入到自己的專案中然後整個專案就可以編譯通過了。