maven中SLF4J:Failedtoloadclass“org.slf4j.impl.StaticLoggerBinder的錯誤怎么解決

這篇文章主要介紹“maven中SLF4J: Failed to load class “org.slf4j.impl.StaticLoggerBinder的錯誤怎么解決”,在日常操作中,相信很多人在maven中SLF4J: Failed to load class “org.slf4j.impl.StaticLoggerBinder的錯誤怎么解決問題上存在疑惑,小編查閱了各式資料,整理出簡單好用的操作方法,希望對大家解答”maven中SLF4J: Failed to load class “org.slf4j.impl.StaticLoggerBinder的錯誤怎么解決”的疑惑有所幫助!接下來,請跟著小編一起來學習吧!

創(chuàng)新互聯(lián)公司專注于烏蘇網(wǎng)站建設服務及定制,我們擁有豐富的企業(yè)做網(wǎng)站經(jīng)驗。 熱誠為您提供烏蘇營銷型網(wǎng)站建設,烏蘇網(wǎng)站制作、烏蘇網(wǎng)頁設計、烏蘇網(wǎng)站官網(wǎng)定制、小程序定制開發(fā)服務,打造烏蘇網(wǎng)絡公司原創(chuàng)品牌,更為您提供烏蘇網(wǎng)站排名全網(wǎng)營銷落地服務。

SLF4J: Failed to load class “org.slf4j.impl.StaticLoggerBinder

最近寫新項目用maven引入sl4j總是提示這個錯誤,查了一下一些是因為引入的包沖突。比如:https://www.jianshu.com/p/b562b7ff499f

這里寫的比較詳細:

slf4j-log4j12.jar (for log4j logging),
slf4j-jdk14.jar (for Java logging),
slf4j-jcl.jar (if you’re using Commons logging)
logback-classic.jar (for logback logging).

以上的包引入一種即可

我的一開始以為是包沖突,然后通過依賴樹命令發(fā)現(xiàn)是一個低級錯誤,引入的sl4j包的scope是test級別的,然后運行就出錯了。直接去掉即可,不寫<scope>標簽默認compile級別。

D:\work\eclipse8\abc\share>mvn dependency:tree
[INFO] Scanning for projects...
[INFO]
[INFO] ---------------------------< xgame:sharing >----------------------------
[INFO] Building sharing 0.0.1
[INFO] --------------------------------[ jar ]---------------------------------
[INFO]
[INFO] --- maven-dependency-plugin:2.8:tree (default-cli) @ sharing ---
[INFO] xgame:sharing:jar:0.0.1
[INFO] +- io.netty:netty-all:jar:4.1.38.Final:compile
[INFO] +- commons-lang:commons-lang:jar:2.6:compile
[INFO] +- org.mybatis:mybatis:jar:3.2.7:compile
[INFO] +- com.google.protobuf:protobuf-java:jar:2.5.0:compile
[INFO] +- com.google.guava:guava:jar:19.0:compile
[INFO] +- commons-codec:commons-codec:jar:1.13:compile
[INFO] +- commons-beanutils:commons-beanutils:jar:1.8.3:compile
[INFO] |  \- commons-logging:commons-logging:jar:1.1.1:compile
[INFO] +- com.lmax:disruptor:jar:3.3.7:compile
[INFO] +- org.quartz-scheduler:quartz:jar:2.2.3:compile
[INFO] |  +- c3p0:c3p0:jar:0.9.1.1:compile
[INFO] |  \- org.slf4j:slf4j-api:jar:1.7.7:compile
[INFO] +- net.sf.json-lib:json-lib:jar:jdk15:2.4:compile
[INFO] |  +- commons-collections:commons-collections:jar:3.2.1:compile
[INFO] |  \- net.sf.ezmorph:ezmorph:jar:1.0.6:compile
[INFO] +- com.typesafe:config:jar:1.3.4:compile
[INFO] +- MySQL:mysql-connector-java:jar:5.1.8:compile
[INFO] \- org.slf4j:slf4j-log4j12:jar:1.7.26:test
[INFO]    \- log4j:log4j:jar:1.2.17:test
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time:  1.907 s
[INFO] Finished at: 2019-08-16T00:21:52+08:00
[INFO] ------------------------------------------------------------------------

查maven依賴版本的時候,默認帶了scope為test。

<!-- https://mvnrepository.com/artifact/org.slf4j/slf4j-log4j12 -->
<dependency>
    <groupId>org.slf4j</groupId>
    <artifactId>slf4j-log4j12</artifactId>
    <version>1.7.26</version>
    <scope>test</scope>
</dependency>

到此,關于“maven中SLF4J: Failed to load class “org.slf4j.impl.StaticLoggerBinder的錯誤怎么解決”的學習就結束了,希望能夠解決大家的疑惑。理論與實踐的搭配能更好的幫助大家學習,快去試試吧!若想繼續(xù)學習更多相關知識,請繼續(xù)關注創(chuàng)新互聯(lián)網(wǎng)站,小編會繼續(xù)努力為大家?guī)砀鄬嵱玫奈恼拢?/p>

網(wǎng)站標題:maven中SLF4J:Failedtoloadclass“org.slf4j.impl.StaticLoggerBinder的錯誤怎么解決
分享URL:http://bm7419.com/article30/gihiso.html

成都網(wǎng)站建設公司_創(chuàng)新互聯(lián),為您提供定制開發(fā)、網(wǎng)站排名、響應式網(wǎng)站、網(wǎng)站收錄小程序開發(fā)、建站公司

廣告

聲明:本網(wǎng)站發(fā)布的內(nèi)容(圖片、視頻和文字)以用戶投稿、用戶轉載內(nèi)容為主,如果涉及侵權請盡快告知,我們將會在第一時間刪除。文章觀點不代表本網(wǎng)站立場,如需處理請聯(lián)系客服。電話:028-86922220;郵箱:631063699@qq.com。內(nèi)容未經(jīng)允許不得轉載,或轉載時需注明來源: 創(chuàng)新互聯(lián)

小程序開發(fā)