SLF4J: Detected both log4j-over-slf4j.jar AND bound slf4j-log4j12.jar on the class path

If the log jar packages referenced by Maven dependent components conflict, an error will be reported:

“SLF4J: Detected both log4j-over-slf4j.jar AND bound slf4j-log4j12.jar on the class path”

 

resolvent:

In specific dependencies & lt; dependency>& lt;/ dependency> Add the following contents:

<exclusions>
    <exclusion>
        <groupId>org.slf4j</groupId>
        <artifactId>slf4j-log4j12</artifactId>
    </exclusion>
</exclusions>

If you still report an error, you can replace it with the following:

<exclusions>
    <exclusion>
        <groupId>org.slf4j</groupId>
        <artifactId>slf4j-log4j12</artifactId>
    </exclusion>
    <exclusion>
        <groupId>log4j</groupId>
        <artifactId>log4j</artifactId>
    </exclusion>
</exclusions>

*After adding content, refresh maven, otherwise the running program will still report an error!

 

There are many ways to operate in the idea interface:

a. Click reload all Maven projects on the Maven interface

b. Right click the item name  -& gt; Maven -> Reload project

c. Right click the pom.xml file  -& gt; Maven -> Reload project

d. Right click – & gt; in the pom.xml editing interface; Maven -> Reload project

 

Similar Posts: