《Springboot极简教程》问题解决:Idea解决Gradle库依赖冲突问题:Detected both log4j-over-slf4j.jar AND slf4j-log4j12.jar on the class path, preempting StackOverflow

简介: 错误日志Caused by: java.lang.IllegalStateException: Detected both log4j-over-slf4j.

错误日志

Caused by: java.lang.IllegalStateException: Detected both log4j-over-slf4j.jar AND bound slf4j-log4j12.jar on the class path, preempting StackOverflowError. See also http://www.slf4j.org/codes.html#log4jDelegationLoop for more details.
    at org.slf4j.impl.Log4jLoggerFactory.<clinit>(Log4jLoggerFactory.java:54)
    ... 11 more
:bootRun FAILED

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

classpath jar包冲突

gradle -q app:dependencies

依赖树分析

参考:
https://docs.gradle.org/current/userguide/userguide_single.html#sec:listing_dependencies

解决方案

排除冲突的依赖:

Maven:

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

Gradle:

compile('org.raml:raml-parser:0.8.12'){
        exclude module: 'slf4j-log4j12'
        exclude module: 'log4j'
}
相关文章
|
21天前
|
Java Maven 微服务
springboot项目开启远程调试-jar包
springboot项目开启远程调试-jar包
17 0
|
2月前
|
Java 程序员 API
Springboot-swagger配置(idea社区版2023.1.4+apache-maven-3.9.3-bin)
Springboot-swagger配置(idea社区版2023.1.4+apache-maven-3.9.3-bin)
58 1
|
2月前
|
前端开发 Java 数据库连接
Springboot-MyBatis配置-配置端口号与服务路径(idea社区版2023.1.4+apache-maven-3.9.3-bin)
Springboot-MyBatis配置-配置端口号与服务路径(idea社区版2023.1.4+apache-maven-3.9.3-bin)
33 0
|
7天前
|
Java 应用服务中间件 Maven
使用IDEA搭建SpringMVC环境,Maven导入了依赖,但是运行报错 java.lang.ClassNotFoundException
使用IDEA搭建SpringMVC环境,Maven导入了依赖,但是运行报错 java.lang.ClassNotFoundException
8 1
|
21天前
|
数据建模 Go vr&ar
idea配置go依赖下载
idea配置go依赖下载
16 0
|
21天前
|
存储 Java Spring
SpringBoot的 jar 可以直接运行
SpringBoot的 jar 可以直接运行
14 0
|
23天前
|
监控 Java 测试技术
日志框架到底是Logback 还是 Log4j2
日志框架到底是Logback 还是 Log4j2
17 0
|
1月前
|
Java Shell API
通用Shell脚本执行Spring Boot项目Jar包
通用Shell脚本执行Spring Boot项目Jar包
|
1月前
|
Java Maven
idea的Maven依赖问题
idea的Maven依赖问题
|
1月前
|
Java Maven
idea中如何创建SpringBoot项目
idea中如何创建SpringBoot项目