突然得到“LoggerFactory 不是 Logback LoggerContext,但 Logback 在类路径上。” 并且无法运行

Jac*_*kie 6 gradle spring-boot

我使用 gradle 并latest.release到处都是混杂的,但是,最近我的 Spring boot 应用程序停止从命令行运行。当我跑步时gradle clean bootRun我得到...

线程“main”中出现异常 java.lang.IllegalArgumentException:LoggerFactory 不是 Logback LoggerContext,但 Logback 位于类路径上。删除 Logback 或竞争实现(从文件加载的类 org.slf4j.impl.Log4jLoggerFactory:/.../.gradle/caches/modules-2/files-2.1/org.slf4j/slf4j-log4j12/1.7.25/ 110cefe2df103412849d72ef7a67e4e91e4266b4/slf4j-log4j12-1.7.25.jar)。如果您使用WebLogic,则需要将“org.slf4j”添加到WEB-INF/weblogic.xml中的prefer-application-packages中:org.slf4j.impl.Log4jLoggerFactory

根据这篇文章我尝试过...

configurations.all {
    exclude group: 'org.springframework.boot', module: 'spring-boot-starter-tomcat'
    exclude group: 'org.springframework.boot', module: 'spring-boot-starter-logging'
    exclude group: 'org.springframework.boot', module: 'logback-classic'
    exclude group: "org.slf4j"
}
Run Code Online (Sandbox Code Playgroud)

这会消除 Logback 错误,但 spring 不会启动并且失败,没有错误。

引起原因:org.gradle.process.internal.ExecException:处理'命令'/Library/Java/JavaVirtualMachines/jdk-10.0.1.jdk/Contents/Home/bin/java''以非零退出值1完成

我缺少什么?

rup*_*web 5

spring-boot-starter-logging我有这个并通过排除和logback-classic添加 spring log4j2 实现来修复它gradle.build

configurations {
    all {
        exclude group: 'org.springframework.boot', module: 'spring-boot-starter-logging'
        exclude group: 'ch.qos.logback', module: 'logback-classic'
    }
}

dependencies {
    implementation 'org.springframework.boot:spring-boot-starter-log4j2:2.2.6.RELEASE'
Run Code Online (Sandbox Code Playgroud)


Jac*_*kie 0

需要删除..compile 'org.apache.spark:spark-sql_2.11:latest.release'

还没弄清楚为什么。