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:
- Factory method ‘eurekaClient’ threw exception; nested exception is java.lang.RuntimeException: Failed to initialize DiscoveryClient!
- ERROR in ch.qos.logback.core.joran.spi.Interpreter@73:41 – no applicable action for [AppenderRef], current ElementPath is [[Configuration][Loggers][Root][AppenderRef]]
- java.lang.NoClassDefFoundError: Could not initialize class org.apache.log4j.Log4jLoggerFactory
- [Solved] SpringBoot Access Redis Error: java.lang.NoSuchMethodError: redis.clients.jedis.JedisPoolConfig.setMinEvictableIdleTime
- [Solved] java.lang.NoSuchMethodError: javax.persistence.spi.PersistenceUni
- Using Maven helper to resolve Maven plug-in conflicts
- [Solved] SLF4J: Failed to load class “org.slf4j.impl.StaticLoggerBinder”.
- Springboot is compatible with jackson.databind and reports errors [How to Solve]
- [Exception] LoggerFactory is not a Logback LoggerContext but Logback is on the classpath. Either r…
- Could not transfer artifact org.glassfish:javax.el:pom:3.0.1-b06-SNAPSHOT from/to jvnet-nexus-snapshots (https://maven.java.net/content/repositories/snapshots)