Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

How to solve the error of SLF4J: Failed to load class "org.slf4j.impl.StaticLoggerBinder in maven

2025-01-19 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Internet Technology >

Share

Shulou(Shulou.com)06/02 Report--

This article mainly introduces "how to solve the error of SLF4J: Failed to load class in maven". In the daily operation, it is believed that many people have doubts about how to solve the error of SLF4J: Failed to load class "org.slf4j.impl.StaticLoggerBinder in maven. The editor consulted all kinds of materials and sorted out simple and useful operation methods. I hope it will be helpful to answer the question of "SLF4J: Failed to load class in maven" and "how to solve the error of org.slf4j.impl.StaticLoggerBinder"! Next, please follow the editor to study!

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

Recently, the introduction of sl4j with maven for new projects always prompts this error, checking some because of introduced package conflicts. For example: https://www.jianshu.com/p/b562b7ff499f

What is written here is more detailed:

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). One of the above packages can be introduced.

At first, I thought it was a package conflict, then through the dependency tree command, I found that it was a low-level error. The scope of the introduced sl4j package was test-level, and then it went wrong. It can be removed directly, and the default compile level is not written.

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]-

When checking the dependent version of maven, scope is test by default.

Org.slf4j slf4j-log4j12 1.7.26 test so far, the study on "SLF4J in maven: Failed to load class how to solve the org.slf4j.impl.StaticLoggerBinder error" is over. I hope to be able to solve everyone's doubts. The collocation of theory and practice can better help you learn, go and try it! If you want to continue to learn more related knowledge, please continue to follow the website, the editor will continue to work hard to bring you more practical articles!

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Internet Technology

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report