【发布时间】:2020-08-08 23:30:29
【问题描述】:
我不完全确定为什么它停止工作。我的项目几周前还在工作,但我刚刚尝试再次运行它,但我只是收到有关日志记录的 StackOverflowError
我正在运行的应用程序没有导致此问题,因为我已将 main 方法替换为空的方法:
class Application {
companion object {
@JvmStatic
fun main(vararg args: String) {
println("Hello, world.");
}
}
}
在控制台中出现以下错误(我已经删除了大部分,因为它只是导致 StackOverflowError 的重复):
SLF4J: Class path contains multiple SLF4J bindings.
SLF4J: Found binding in [jar:file:/Users/user/.gradle/caches/modules-2/files-2.1/org.apache.logging.log4j/log4j-slf4j-impl/2.11.2/4d44e4edc4a7fb39f09b95b09f560a15976fa1ba/log4j-slf4j-impl-2.11.2.jar!/org/slf4j/impl/StaticLoggerBinder.class]
SLF4J: Found binding in [jar:file:/Users/user/.gradle/caches/modules-2/files-2.1/ch.qos.logback/logback-classic/1.2.3/7c4f3c474fb2c041d8028740440937705ebb473a/logback-classic-1.2.3.jar!/org/slf4j/impl/StaticLoggerBinder.class]
SLF4J: See http://www.slf4j.org/codes.html#multiple_bindings for an explanation.
SLF4J: Actual binding is of type [org.apache.logging.slf4j.Log4jLoggerFactory]
Exception in thread "main" java.lang.StackOverflowError
at org.apache.logging.log4j.util.StackLocator.getCallerClass(StackLocator.java:121)
at org.apache.logging.log4j.util.StackLocatorUtil.getCallerClass(StackLocatorUtil.java:55)
at org.apache.logging.slf4j.Log4jLoggerFactory.getContext(Log4jLoggerFactory.java:42)
at org.apache.logging.log4j.spi.AbstractLoggerAdapter.getLogger(AbstractLoggerAdapter.java:46)
at org.apache.logging.slf4j.Log4jLoggerFactory.getLogger(Log4jLoggerFactory.java:29)
at org.slf4j.LoggerFactory.getLogger(LoggerFactory.java:358)
at org.apache.logging.slf4j.SLF4JLoggerContext.getLogger(SLF4JLoggerContext.java:39)
at org.apache.logging.slf4j.Log4jLoggerFactory.newLogger(Log4jLoggerFactory.java:37)
at org.apache.logging.slf4j.Log4jLoggerFactory.newLogger(Log4jLoggerFactory.java:29)
at org.apache.logging.log4j.spi.AbstractLoggerAdapter.getLogger(AbstractLoggerAdapter.java:52)
at org.apache.logging.slf4j.Log4jLoggerFactory.getLogger(Log4jLoggerFactory.java:29)
at org.slf4j.LoggerFactory.getLogger(LoggerFactory.java:358)
at org.apache.logging.slf4j.SLF4JLoggerContext.getLogger(SLF4JLoggerContext.java:39)
at org.apache.logging.slf4j.Log4jLoggerFactory.newLogger(Log4jLoggerFactory.java:37)
at org.apache.logging.slf4j.Log4jLoggerFactory.newLogger(Log4jLoggerFactory.java:29)
at org.apache.logging.log4j.spi.AbstractLoggerAdapter.getLogger(AbstractLoggerAdapter.java:52)
at org.apache.logging.slf4j.Log4jLoggerFactory.getLogger(Log4jLoggerFactory.java:29)
at org.slf4j.LoggerFactory.getLogger(LoggerFactory.java:358)
at org.apache.logging.slf4j.SLF4JLoggerContext.getLogger(SLF4JLoggerContext.java:39)
at org.apache.logging.slf4j.Log4jLoggerFactory.newLogger(Log4jLoggerFactory.java:37)
at org.apache.logging.slf4j.Log4jLoggerFactory.newLogger(Log4jLoggerFactory.java:29)
at org.apache.logging.log4j.spi.AbstractLoggerAdapter.getLogger(AbstractLoggerAdapter.java:52)
at org.apache.logging.slf4j.Log4jLoggerFactory.getLogger(Log4jLoggerFactory.java:29)
at org.slf4j.LoggerFactory.getLogger(LoggerFactory.java:358)
这些是我的 gradle 依赖项:
dependencies {
// Main
implementation "$kotlin_group:kotlin-stdlib-jdk8:$kotlin_version"
implementation "$corda_group:corda-core:$corda_release_version"
implementation "$corda_group:corda-rpc:$corda_release_version"
implementation "$springboot_group:spring-boot-starter-web:$springboot_release_version"
implementation "$newco_group:newco-kotlin-core:$newco_kotlin_core_release_version"
implementation "$newco_group:newco-kotlin-libex:$newco_libex_release_version"
implementation "$newco_group:newco-kotlin-libex-services:$newco_libex-services_release_version"
implementation "$newco_group:newco-corda-fintex-contract:$newco_fintex_release_version"
implementation "$newco_group:newco-corda-fintex-workflow:$newco_fintex_release_version"
implementation "$newco_group:newco-corda-fintex-integration:$newco_fintex_release_version"
implementation project(":cordapp-contract")
implementation project(":cordapp-workflow")
implementation project(":cordapp-integration")
// Test
testRuntimeOnly "$junit_group:junit-jupiter-engine:$junit_version"
testImplementation "$junit_group:junit-jupiter-api:$junit_version"
testImplementation "$kotlin_group:kotlin-test:$kotlin_version"
testImplementation "$corda_group:corda-node-driver:$corda_release_version"
}
我尝试将其添加到 gradle 但无济于事:
configurations {
all {
exclude module: 'slf4j-log4j12'
exclude module: 'jms'
exclude module: 'jmxtools'
exclude module: 'jmxri'
}
}
有什么想法吗? - 我不知道从哪里开始
【问题讨论】:
-
尝试查看依赖树找出多个jar位置,然后从一个中排除。
标签: spring-boot kotlin log4j slf4j corda