gpt4 book ai didi

spring-boot - 突然得到 "LoggerFactory is not a Logback LoggerContext but Logback is on the classpath."并且无法运行

转载 作者:行者123 更新时间:2023-12-03 03:18:44 26 4
gpt4 key购买 nike

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

Exception in thread "main" java.lang.IllegalArgumentException: LoggerFactory is not a Logback LoggerContext but Logback is on the classpath. Either remove Logback or the competing implementation (class org.slf4j.impl.Log4jLoggerFactory loaded from file:/.../.gradle/caches/modules-2/files-2.1/org.slf4j/slf4j-log4j12/1.7.25/110cefe2df103412849d72ef7a67e4e91e4266b4/slf4j-log4j12-1.7.25.jar). If you are using WebLogic you will need to add 'org.slf4j' to prefer-application-packages in WEB-INF/weblogic.xml: org.slf4j.impl.Log4jLoggerFactory



this post我试过...
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"
}

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

Caused by: org.gradle.process.internal.ExecException: Process 'command '/Library/Java/JavaVirtualMachines/jdk-10.0.1.jdk/Contents/Home/bin/java'' finished with non-zero exit value 1



我错过了什么?

最佳答案

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

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'

关于spring-boot - 突然得到 "LoggerFactory is not a Logback LoggerContext but Logback is on the classpath."并且无法运行,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/50824361/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com