Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

slf4j exception with quartz

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.

like image 937
Abhishek Avatar asked Mar 18 '11 03:03

Abhishek


2 Answers

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.

like image 107
Nr9 Avatar answered Oct 23 '22 03:10

Nr9


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.

like image 39
yegor256 Avatar answered Oct 23 '22 03:10

yegor256