Quartz Error Misfire处理和作业恢复失败

时间:2015-07-15 06:30:07

标签: java jsp persistence quartz-scheduler job-scheduling

我是JSP和Quartz Scheduling的新手!在这个项目中,我试图让石英调度程序继续运行,以防服务器关闭,然后忽略丢失的作业。

为此,我研究了JobPersistence,并修改了quartz.properties文件,如下所示:

org.quartz.threadPool.threadCount=5
org.quartz.jobStore.class = org.quartz.impl.jdbcjobstore.JobStoreTX
org.quartz.jobStore.tablePrefix = QRTZ_
org.quartz.jobStore.useProperties = true
org.quartz.jobStore.driverDelegateClass = org.quartz.impl.jdbcjobstore.StdJDBCDelegate
org.quartz.jobStore.dataSource = myDB
org.quartz.dataSource.myDB.driver = com.mysql.jdbc.Driver
org.quartz.dataSource.myDB.URL = jdbc:mysql://localhost:3306/contacts
org.quartz.dataSource.myDB.user = root
org.quartz.dataSource.myDB.password = root

web.xml文件包含以下内容:

...
<listener>
   <listener-class>
      org.quartz.ee.servlet.QuartzInitializerListener
   </listener-class>
</listener>
...

我已将表格添加到数据库中,当我选择时,我可以看到它确实在其表格中插入了触发器。

触发器构建如下:

Trigger trig = TriggerBuilder
  .newTrigger()
  .startAt(scal.getTime())
  .withSchedule(
     SimpleScheduleBuilder.simpleSchedule()
    .withIntervalInMinutes(minutes).repeatForever())
  .endAt(ecal.getTime()).build();

现在,当我运行我的网络应用程序时,我会安排一份工作并执行。然后,我关闭tomcat服务器并重新启动它。它将以下错误输出到记录器:

org.quartz.SchedulerConfigException: Failure occured during job recovery. [See nested exception: org.quartz.JobPersistenceException: Couldn't recover jobs: null [See nested exception: java.lang.NullPointerException]]

我已尝试在MySQLWorkbench中执行以下语句:

UPDATE QRTZ_TRIGGERS SET NEXT_FIRE_TIME=1 WHERE NEXT_FIRE_TIME < 0;

现在,我收到了这个新错误:

.manage - MisfireHandler: Error handling misfires: Unexpected runtime exception: null

org.quartz.JobPersistenceException: Unexpected runtime exception: null [See nested exception: java.lang.NullPointerException]

如果您希望我编辑并包含stackTrace,我可以这样做......

0 个答案:

没有答案