线程中的例外“主” java.lang.stackoverflowerror at org.slf4j.loggerfactory.getlogger(loggerfactory.java:242)
我正在从事一个春季多模块项目。我已将春季版从3.x升级到5.3.17。升级后,运行项目IAM时会出现以下错误: 线程中的异常“ main” java.lang.stackoverflowerror
atorg.slf4j.loggerfactory.getlogger(loggerfactory.java:242)
at rog.apache.commons.logging.logadapter $ SLF4JADAPTER.CREATELOCATEWARELOG(Logadapter.java:130)
at rog.apache.commons.logging.logadapter.createlog(logadapter.java:91)
at rog.apache.commons.logging.logfactory.getlog(logfactory.java:67)
atorg.slf4j.impl.jclloggerfactory.getlogger(jclloggerfactory.java:88)
atorg.slf4j.loggerfactory.getlogger(loggerfactory.java:242)
at rog.apache.commons.logging.logadapter $ slf4jadapter.createLocationAwareLog(logadapter.java:130)
at rog.apache.commons.logging.logadapter.createlog(logadapter.java:91)
at rog.apache.commons.logging.logfactory.getlog(logfactory.java:67)
atorg.slf4j.impl.jclloggerfactory.getlogger(jclloggerfactory.java:88)
in Build.gradle file: compile(组:“ org.springframework”,名称:“弹簧核”,版本:“ 3.0.5.release”)。此处版本更改为5.3.17 适用于spring-contept,spring-web等春季相关依赖项的类似内容。
I am working on a spring multi module project. I have upgraded spring version from 3.x to 5.3.17. After upgradation, while running project Iam getting following error:
Exception in thread "main" java.lang.StackOverflowError
at org.slf4j.LoggerFactory.getLogger(LoggerFactory.java:242)
at org.apache.commons.logging.LogAdapter$Slf4jAdapter.createLocationAwareLog(LogAdapter.java:130)
at org.apache.commons.logging.LogAdapter.createLog(LogAdapter.java:91)
at org.apache.commons.logging.LogFactory.getLog(LogFactory.java:67)
at org.slf4j.impl.JCLLoggerFactory.getLogger(JCLLoggerFactory.java:88)
at org.slf4j.LoggerFactory.getLogger(LoggerFactory.java:242)
at org.apache.commons.logging.LogAdapter$Slf4jAdapter.createLocationAwareLog(LogAdapter.java:130)
at org.apache.commons.logging.LogAdapter.createLog(LogAdapter.java:91)
at org.apache.commons.logging.LogFactory.getLog(LogFactory.java:67)
at org.slf4j.impl.JCLLoggerFactory.getLogger(JCLLoggerFactory.java:88)
in build.gradle file:
compile(group: "org.springframework", name: "spring-core", version: "3.0.5.RELEASE").Here version changed to 5.3.17
similar things applied for spring-context,spring-web etc spring related dependencies in build.gradle
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您的 SLF4J 使用 JCL 作为后端,而您的 JCL 使用 SLF4J 作为后端,因此出现了 StackOverflow。
较新版本的 Spring 有
spring-jcl
作为传递依赖,它们将使用 Jakarta Commons Logging 编码的日志记录重定向到 SLF4J。如果您还有
slf4j-jcl
绑定在执行相反重定向的类路径上,您会收到 StackOverflowException 。只需从依赖项中删除
slf4j-jcl
就可以了。Your SLF4J uses JCL as backend and your JCL uses SLF4J as backend, hence the StackOverflow.
Newer versions of Spring have
spring-jcl
as transitive dependency and they redirect logging coded using Jakarta Commons Logging to SLF4J.If moreover you have a
slf4j-jcl
binding on your classpath that performs the opposite redirect, you get aStackOverflowException
.Just remove
slf4j-jcl
from your dependencies and you should be fine.