slf4j与石英异常

Abh*_*hek 7 maven-2 exception version slf4j quartz-scheduler

我想在项目的一个简单例子中使用quartz.我得到以下异常,我不确定它是什么意思...但是我在我的POM文件中将我的slf4j更新为1.6.1,即使这样仍然出现,

    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)
............
Run Code Online (Sandbox Code Playgroud)

任何有关这方面的帮助将受到高度赞赏.谢谢.

小智 13

您需要所有SLF4J依赖项才能使用相同的版本.

SLF4J: Your binding is version 1.5.5 or earlier.
SLF4J: Upgrade your binding to version 1.6.x. or 2.0.x
Run Code Online (Sandbox Code Playgroud)

如果你看一下你的依赖树,我希望你会找到它所使用的各种jar的SLF4J的一个版本.

例如

[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
Run Code Online (Sandbox Code Playgroud)

这里有两个slf4j deps版本相同.


yeg*_*256 5

看起来石英内部使用的SLF4J绑定太旧了.您应该从quartz中排除旧版本,并将明确的新版本添加到项目中.mvn dependency:tree在此处运行并发布您的结果.那么我将能够给你准确的指示.