web123456

SLF4J: Failed to load class "org.". The solution to this problem

catalogs

  • 1. The problem
  • 2. Principle analysis
  • 3. Solutions

1. The problem

This error occurs when compiling the ssm project
Causes it to never run.

SLF4J: Failed to load class "org.".
SLF4J: Defaulting to no-operation (NOP) logger implementation
SLF4J: See http:///#StaticLoggerBinder for further details.
Logging initialized using 'class ' adapter.
  • 1
  • 2
  • 3
  • 4

Screenshots are shown below:
在这里插入图片描述
Or the following problems may occur: (the problems are more or less of the same nature)
在这里插入图片描述

2. Principle analysis

By looking at theofficial website

A screenshot of the main reasons is below:
在这里插入图片描述

Translated, it means roughly the following:

Log Meaning Failed to load class org.
This warning message is reported when running the "org..." command, this warning message is reported. The StaticLoggerBinder class could not be loaded into memory. This occurs when a suitable SLF4J binding cannot be found in the class path. Bind the slf4j-nopPutting one (and only one) of .jar ,, or into the class path should solve the problem.
Note that the slf4j-api version is 2.0. x and later using the ServiceLoader mechanism. Backends such aslogback 1.3 and higher, targeting slf4j-api 2. Do not distribute with org. If you set up a logging backend targeting slf4j-api 2.0. X, you need to install it on the class path. See the related faq entry.

The reason for the error is that one of the jar packages in , , or is missing, just add it (it can only be one, if there are more, there will be conflicts).

3. Solutions

Through error logs and official explanations
Just add the dependencies if they are missing

Add this dependency package to the configuration file

<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-simple</artifactId>
<version>1.7.25</version>
<scope>compile</scope>
</dependency>
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6

Other dependency packages remember to remove (remove this one)
Be sure to delete, otherwise there will still be errors, and then recompile to generate jar packages after the
在这里插入图片描述

After adding the configuration look to see if there are any jar packages and make sure that there is only one jar package in the above

And the scope should be changed to compile means that when compiling will load this jar package, then finally run successfully
When configuring these dependency packages make sure they are available on the target, which can be done via themaven clean and the compilation and packaging is complete

Finally you can start it successfully