Quartz 2.0 调度程序异常
我们使用的是quartz 2.0框架。我刚刚下载了quartz包并将其放置在我的项目的构建路径中。如果我执行与quartz 1.6相同的调度程序,它会抛出以下异常:
Exception in thread "main" java.lang.NoClassDefFoundError: org.slf4j.LoggerFactory
at org.quartz.impl.StdSchedulerFactory.<init>(StdSchedulerFactory.java:274)
at org.quartz.impl.StdSchedulerFactory.getDefaultScheduler(StdSchedulerFactory.java:1480)
at QuartzTest.main(QuartzTest.java:10)
Caused by: java.lang.ClassNotFoundException: org.slf4j.LoggerFactory
at java.net.URLClassLoader.findClass(URLClassLoader.java:421)
at java.lang.ClassLoader.loadClass(ClassLoader.java:643)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:346)
at java.lang.ClassLoader.loadClass(ClassLoader.java:609)
... 3 more
我的代码到目前为止,如果只是启动和停止调度程序。如果有人能帮助我解决这个问题,我将不胜感激。
同样在 2.x 版本中,我们为 jobdetail 创建对象的方式似乎有点不同。如果我以这种方式创建一个对象:
JobDetail jobDetail = new JobDetail("jobDetail-s1", "jobDetailGroup-s1", SimpleQuartzJob.class);
IDE 说..无法实例化 JobDetail 类型。
请帮忙。
we are using quartz 2.0 framework. I just downloaded quartz packages and placed it in the build path of my project. If i execute the same schedular i used for quartz 1.6, it is throwing the following exception:
Exception in thread "main" java.lang.NoClassDefFoundError: org.slf4j.LoggerFactory
at org.quartz.impl.StdSchedulerFactory.<init>(StdSchedulerFactory.java:274)
at org.quartz.impl.StdSchedulerFactory.getDefaultScheduler(StdSchedulerFactory.java:1480)
at QuartzTest.main(QuartzTest.java:10)
Caused by: java.lang.ClassNotFoundException: org.slf4j.LoggerFactory
at java.net.URLClassLoader.findClass(URLClassLoader.java:421)
at java.lang.ClassLoader.loadClass(ClassLoader.java:643)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:346)
at java.lang.ClassLoader.loadClass(ClassLoader.java:609)
... 3 more
My code as of now, if just starting and stopping schedular. I will appreciate, if any body could help me out in this.
Also in 2.x version, the way we would create an object for jobdetail seems to be a bit different. If i create an object in this manner:
JobDetail jobDetail = new JobDetail("jobDetail-s1", "jobDetailGroup-s1", SimpleQuartzJob.class);
IDE says ..cannot instantiate the type JobDetail.
Please, help.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
请注意,在 Spring 3.1 发布之前,Spring 3 分支不支持 Quartz 2.0
请参阅此处(Spring 发行说明)。
这也让我抓狂,因为他们的示例和我们的旧代码不再起作用。我以为我们损坏了某些东西,但损坏它的是 Spring/Quartz。我切换回 Quartz 1.5.2 和 Spring 3.0.5,一切正常。
Spring 教条变幻莫测的另一个例子。
Note that Quartz 2.0 is not supported by Spring 3 branch until the release of Spring 3.1
See here (Spring release notes).
This drove me nuts too as their examples and our old code did not work anymore. I assumed that we'd broken something, however it was Spring/Quartz that broke it. I switched back to Quartz 1.5.2 and Spring 3.0.5 and everything works well.
Another example of the vagaries of Spring dogma.
Quartz 2.x 迁移指南拥有您所需的一切
The Quartz 2.x Migration Guide has everything you need