Recently, when learning springboot, sometimes it is clear that there is no problem with the project running, but the console will report an error, such as the following problem exception prompt:
From this, we can see that the main error is the jar package of slf4j, and “failed to load class’ org.slf4j.impl.staticloggerbinder” in the fault code means “failed to load class file org.slf4j.impl.staticloggerbinder”.
The solution published on the official website is:
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.
Translated as follows:
This error was reported when org.slf4j.impl. The staticloggerbinder class cannot be loaded into memory. When this happens, the appropriate slf4j binding classpath cannot be found. The classpath of slf4j-nop.jar, slf4j-simple.jar, slf4j-log4j12.jar, slf4j-jdk14.jar or logback-classic.jar should solve this problem.
Therefore, the solution is to load the dependency of one of the above package files (and only one) in the POM file of Maven project. At this time, I load the dependency of “slf4j-nop-1.7.2. Jar” package file, and then the whole project can be compiled without exception.
1 <dependency> 2 <groupId>org.slf4j</groupId> 3 <artifactId>slf4j-nop</artifactId> 4 <version>1.7.2</version> 5 </dependency>
Similar Posts:
- [Solved] SLF4J: Failed to load class “org.slf4j.impl.StaticLoggerBinder”.
- [Solved] IDEA springboot Startup Error: SLF4J:Failed to load class “org.slf4j.impl.StaticLoggerBinder”
- [Solved] SLF4J: Failed to load class “org.slf4j.impl.StaticLoggerBinder”.
- [Solved] Failed to load class “org.slf4j.impl.StaticLoggerBinder
- [Solved] SLF4J: Failed to load class “org.slf4j.impl.StaticLoggerBinder”
- [Solved] JSTL1.2 Error: org.apache.catalina.core.StandardWrapperValve.invoke…
- [Solved] An attempt was made to call a method that does not exist. The attempt was made from the following location:
- IOException: No FileSystem for scheme: hdfs
- Solve the problem of “java.lang.UnsatisfiedLinkError: Native Library .dll already loaded in another classloader”
- [Solved] Error: unable to find or load main class org.apache.zookeeper.server.quorum.QuorumPeerMain