开发者

java ClassNotFoundException LoggerFactory when setting Quartz up

So I'm using the Quartz jar: quartz-all-2.0.1.jar. From the readme, that jar is supposed to have everything set up. However, when I try to create a SchedulerFactory using

SchedulerFactory sf = new StdSchedulerFactory();

I get this:

Exception in thread "main" java.lang.NoClassDefFoundError: org/slf4j/LoggerFactory
    at org.quartz.impl.StdSchedulerFactory.<init>(StdSchedulerFactory.java:268)
    at WebScraper.Main.main(Main.java:19)
Caused by: java.lang.ClassNotFoundException: org.slf4j.LoggerFactory
    at java.net.URLClassLoader$1.run(URLClassLoader.java:217)
    at java.security.AccessController.doPrivileged(Native Method)
    at java.net.URLClassLoader.findClass(URLClassLoader.java:205)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:321)
    at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:294)
    at java.lang.ClassLoader.loadClass开发者_如何转开发(ClassLoader.java:266)

I'm also confused because Eclipse does not show any errors before I try to run the program. Thanks for any help.


The Simple Logging Facade for Java (SLF4J) documentation lists Quartz as depending on slf4j. You could download slf4j and add it to your classpath. I've no idea why it worked earlier without this issue.


You are going to need the slf4j api jar and an implementation jar.

As to why it doesn't complain in eclipse. It is only a runtime dependency. You are not compiling any code that actually uses slf4j, so your code compiles just fine. On the other hand, when you try to run, the code you are dependent on (i.e. Quartz) has a dependency on slf4j that you now have to provide.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜