3

我开发了一些执行石英作业的代码。起初代码在 tomcat 之外并且执行得很好,但是当我尝试将相同的代码嵌入到 Web 应用程序中时,我得到 java.lang.NoClassDefFoundError: org/quartz /禁止并发执行。我正在使用石英 2.1.5,它已经在类路径中。这是堆栈跟踪:

Exception in thread "DefaultQuartzScheduler_QuartzSchedulerThread" java.lang.NoClassDefFoundError: org/quartz/DisallowConcurrentExecution
INFO: Illegal access: this web application instance has been stopped already.  Could not load org.quartz.DisallowConcurrentExecution.  The eventual following stack trace is caused by an error thrown for debugging purposes as well as to attempt to terminate the thread which caused the illegal access, and has no functional impact.
        at org.quartz.impl.JobDetailImpl.isConcurrentExectionDisallowed(JobDetailImpl.java:390)
java.lang.IllegalStateException
        at org.quartz.simpl.RAMJobStore.acquireNextTriggers(RAMJobStore.java:1447)
        at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1273)
        at org.quartz.core.QuartzSchedulerThread.run(QuartzSchedulerThread.java:264)
        at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1233)
Caused by: java.lang.ClassNotFoundException: org.quartz.DisallowConcurrentExecution
        at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:320)
        at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1387)
        at org.quartz.impl.JobDetailImpl.isConcurrentExectionDisallowed(JobDetailImpl.java:390)
        at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1233)
        at org.quartz.simpl.RAMJobStore.acquireNextTriggers(RAMJobStore.java:1447)
        at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:320)
        at org.quartz.core.QuartzSchedulerThread.run(QuartzSchedulerThread.java:264)
4

3 回答 3

3

确保你的类路径中只有 1 个quartz-all-.jar(也许你的 Tomcat lib 文件夹中有 2 : 1 + 你的战争中有 1 个)

于 2012-06-18T16:51:03.123 回答
0

NoClassDefFoundErrors 指向类路径中缺少的 JAR 或类。在这种情况下,问题很可能是在 Tomcat 中quartz-<ver>.jar,当您实际需要quartz-all-<ver>.jar.

于 2012-06-18T16:32:04.420 回答
0

对于使用 maven 的人,可以通过 add 使用新版本

    <dependency>
        <groupId>org.quartz-scheduler</groupId>
        <artifactId>quartz</artifactId>
        <version>2.1.7</version>
    </dependency>
于 2017-04-26T05:44:22.337 回答