Alex Rivera | Logout

java ClassNotFoundException LoggerFactory when setting Quartz up

Asked 2011-04-26T20:41:30.817
10

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.

Edit
Report

1 Answer

2

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.

answered 2011-04-26T21:05:49.063

Your Answer