slf4j exception with quartz

匿名 (未验证) 提交于 2019-12-03 00:48:01

问题:

I am trying to use quartz in a simple example in project. I am getting the following exception, I am not sure what it means...However I updated my slf4j to 1.6.1 in my POM file even then this still appears,

    SLF4J: slf4j-api 1.6.x (or later) is incompatible with this binding. SLF4J: Your binding is version 1.5.5 or earlier. SLF4J: Upgrade your binding to version 1.6.x. or 2.0.x Exception in thread "main" java.lang.NoSuchMethodError: org.slf4j.impl.StaticLoggerBinder.getSingleton()Lorg/slf4j/impl/StaticLoggerBinder;     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:155)     at org.apache.commons.logging.impl.SLF4JLogFactory.getInstance(SLF4JLogFactory.java:131)     at org.apache.commons.logging.LogFactory.getLog(LogFactory.java:395)     at org.quartz.impl.StdSchedulerFactory.<init>(StdSchedulerFactory.java:249) ............

Any help on this would be highly appreciated. Thanks.

回答1:

You need all your SLF4J dependencies to use the same version.

SLF4J: Your binding is version 1.5.5 or earlier. SLF4J: Upgrade your binding to version 1.6.x. or 2.0.x

If you look at your dependency tree, I expect that you'll find more then one version of SLF4J for the various jar it uses.

For example

[INFO] +- org.hibernate:hibernate-core:jar:3.5.3-Final:compile [INFO] |  +- antlr:antlr:jar:2.7.7:compile (version managed from 2.7.6) [INFO] |  \- org.slf4j:slf4j-api:jar:1.5.8:compile [INFO] +- org.slf4j:slf4j-log4j12:jar:1.5.8:compile

Here the two slf4j deps have the same version.



回答2:

Looks like the SLF4J binding used inside quartz is too old. You should exclude the old version from quartz and add a new one explicitly to your project. Run mvn dependency:tree and post your result here. I will be able to give you exact instructions then.



转载请标明出处:slf4j exception with quartz
标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!