2011-03-18 95 views
7

我想在一個簡單的例子項目中使用石英。我收到以下異常,我不知道這意味着什麼......不過我我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) 
............ 

任何幫助就這將是非常讚賞。謝謝。

回答

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 

如果你看看你的依賴關係樹,我希望你會發現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具有相同的版本。

5

看起來像石英內使用的SLF4J綁定太舊了。您應該從石英中排除舊版本,並明確向項目中添加一個新版本。運行mvn dependency:tree並在此處發佈您的結果。那麼我將能夠給你確切的指示。