作者热门文章
- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
我正在为我的应用程序使用以下内容:-
[INFO] +- ch.qos.logback:logback-core:jar:1.1.7:compile
[INFO] +- ch.qos.logback:logback-classic:jar:1.1.7:compile
[INFO] +- log4j:log4j:jar:1.2.13:compile
[INFO] +- org.slf4j:slf4j-api:jar:1.6.1:compile
[INFO] +- org.slf4j:jcl-over-slf4j:jar:1.6.1:compile
当我用我的应用程序启动 tomcat 时。我收到以下错误:-
Failed to instantiate [ch.qos.logback.classic.LoggerContext]
Reported exception:
java.lang.NoSuchMethodError: ch.qos.logback.core.rolling.helper.FileNamePattern.getDateTokenConverter()Lch/qos/logback/core/rolling/helper/DateTokenConverter;
at ch.qos.logback.core.rolling.IntervalledTimeBasedFileNamingAndTriggeringPolicyBase.start(IntervalledTimeBasedFileNamingAndTriggeringPolicyBase.java:24)
at ch.qos.logback.core.rolling.SizeAndIntervalledTimeBasedFNATP.start(SizeAndIntervalledTimeBasedFNATP.java:21)
at ch.qos.logback.core.rolling.TimeBasedRollingPolicy.start(TimeBasedRollingPolicy.java:95)
at ch.qos.logback.core.joran.action.NestedComplexPropertyIA.end(NestedComplexPropertyIA.java:161)
at ch.qos.logback.core.joran.spi.Interpreter.callEndAction(Interpreter.java:309)
at ch.qos.logback.core.joran.spi.Interpreter.endElement(Interpreter.java:193)
at ch.qos.logback.core.joran.spi.Interpreter.endElement(Interpreter.java:179)
at ch.qos.logback.core.joran.spi.EventPlayer.play(EventPlayer.java:62)
at ch.qos.logback.core.joran.GenericConfigurator.doConfigure(GenericConfigurator.java:155)
at ch.qos.logback.core.joran.GenericConfigurator.doConfigure(GenericConfigurator.java:142)
at ch.qos.logback.core.joran.GenericConfigurator.doConfigure(GenericConfigurator.java:103)
at ch.qos.logback.core.joran.GenericConfigurator.doConfigure(GenericConfigurator.java:53)
at ch.qos.logback.classic.util.ContextInitializer.configureByResource(ContextInitializer.java:75)
at ch.qos.logback.classic.util.ContextInitializer.autoConfig(ContextInitializer.java:150)
at org.slf4j.impl.StaticLoggerBinder.init(StaticLoggerBinder.java:84)
at org.slf4j.impl.StaticLoggerBinder.<clinit>(StaticLoggerBinder.java:55)
at org.slf4j.LoggerFactory.bind(LoggerFactory.java:121)
at org.slf4j.LoggerFactory.performInitialization(LoggerFactory.java:111)
at org.slf4j.LoggerFactory.getILoggerFactory(LoggerFactory.java:268)
at org.slf4j.LoggerFactory.getLogger(LoggerFactory.java:241)
at org.apache.commons.logging.impl.SLF4JLogFactory.getInstance(SLF4JLogFactory.java:156)
at org.apache.commons.logging.impl.SLF4JLogFactory.getInstance(SLF4JLogFactory.java:132)
at org.apache.commons.logging.LogFactory.getLog(LogFactory.java:645)
at org.springframework.core.SpringProperties.<clinit>(SpringProperties.java:51)
at org.springframework.beans.CachedIntrospectionResults.<clinit>(CachedIntrospectionResults.java:97)
at org.springframework.web.util.IntrospectorCleanupListener.contextInitialized(IntrospectorCleanupListener.java:75)
at org.apache.catalina.core.StandardContext.listenerStart(StandardContext.java:4716)
at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5178)
at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:152)
at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:724)
at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:700)
at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:734)
at org.apache.catalina.startup.HostConfig.deployWAR(HostConfig.java:952)
at org.apache.catalina.startup.HostConfig$DeployWar.run(HostConfig.java:1823)
at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
at java.util.concurrent.FutureTask.run(FutureTask.java:266)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
at java.lang.Thread.run(Thread.java:745)
SLF4J: The requested version 1.7.16 by your slf4j binding is not compatible with [1.6]
当我在 logback 中搜索 "ch.qos.logback.core.rolling.helper.FileNamePattern.getDateTokenConverter()" 时。我开始知道这种方法在 logback 较新版本中无效。
它的解决方法是什么?
最佳答案
似乎 tomcat 加载了多个版本的 logback
。 stacktrace 中引用的代码已于 2011 年在此 commit 中删除.所以你必须检查 tomcat 加载的库或将你的 logback 版本降级到 1.0.0
。
关于java.lang.NoSuchMethodError : ch. qos.logback.core.rolling.helper.FileNamePattern.getDateTokenConverter() 问题,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/39099385/
我正在为我的应用程序使用以下内容:- [INFO] +- ch.qos.logback:logback-core:jar:1.1.7:compile [INFO] +- ch.qos.logback:
我是一名优秀的程序员,十分优秀!