slf4j与石英异常

问题描述:

我想在一个简单的例子项目中使用石英。我收到以下异常,我不知道这意味着什么......不过我我SLF4J更新到1.6.1在我的POM文件即使这样,这仍然会出现,slf4j与石英异常

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) 
............ 

任何帮助就这将是非常赞赏。谢谢。

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

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

如果你看看你的依赖关系树,我希望你会发现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 

这里两个SLF4J DEPS具有相同的版本。

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