Spring + Quartz错误检索作业,将触发状态设置为ERROR。:org.quartz.JobPersistenceException

时间:2017-05-17 00:03:06

标签: java spring quartz-scheduler

我们在JBoss EAP 6.4上使用Spring 4.1.3从一个JSF Web应用程序运行Quartz 2.2.1(我们使用Quartz来安排用户提交的查询,以便我们可以平衡一次运行的程度)。 JDK 8.

有时我们在日志中看到以下错误,作业永远不会运行:

  16:07:02,343 ERROR [org.springframework.scheduling.quartz.LocalDataSourceJobStore] (scheduler_MyJob_QuartzSchedulerThread) Error retrieving job, setting trigger state to ERROR.: org.quartz.JobPersistenceException: Couldn't retrieve job because the BLOB couldn't be deserialized: null [See nested exception: java.io.EOFException]
   at org.quartz.impl.jdbcjobstore.JobStoreSupport.retrieveJob(JobStoreSupport.java:1392) [quartz-2.2.1.jar:]
   at org.quartz.impl.jdbcjobstore.JobStoreSupport.triggerFired(JobStoreSupport.java:2964) [quartz-2.2.1.jar:]
   at org.quartz.impl.jdbcjobstore.JobStoreSupport$43.execute(JobStoreSupport.java:2908) [quartz-2.2.1.jar:]
   at org.quartz.impl.jdbcjobstore.JobStoreSupport$43.execute(JobStoreSupport.java:2901) [quartz-2.2.1.jar:]
   at org.quartz.impl.jdbcjobstore.JobStoreSupport.executeInNonManagedTXLock(JobStoreSupport.java:3787) [quartz-2.2.1.jar:]
   at org.quartz.impl.jdbcjobstore.JobStoreSupport.triggersFired(JobStoreSupport.java:2900) [quartz-2.2.1.jar:]
   at org.quartz.core.QuartzSchedulerThread.run(QuartzSchedulerThread.java:336) [quartz-2.2.1.jar:]
Caused by: java.io.EOFException
   at java.io.ObjectInputStream$PeekInputStream.readFully(ObjectInputStream.java:2328) [rt.jar:1.8.0_45]
   at java.io.ObjectInputStream$BlockDataInputStream.readShort(ObjectInputStream.java:2797) [rt.jar:1.8.0_45]
   at java.io.ObjectInputStream.readStreamHeader(ObjectInputStream.java:802) [rt.jar:1.8.0_45]
   at java.io.ObjectInputStream.<init>(ObjectInputStream.java:299) [rt.jar:1.8.0_45]
   at org.quartz.impl.jdbcjobstore.oracle.OracleDelegate.getObjectFromBlob(OracleDelegate.java:139) [quartz-2.2.1.jar:]
   at org.quartz.impl.jdbcjobstore.StdJDBCDelegate.selectJobDetail(StdJDBCDelegate.java:860) [quartz-2.2.1.jar:]
   at org.quartz.impl.jdbcjobstore.JobStoreSupport.retrieveJob(JobStoreSupport.java:1385) [quartz-2.2.1.jar:]
   ... 6 more

以下是调度程序的配置:

       <bean id="scheduler_myJob"
          class="org.springframework.scheduling.quartz.SchedulerFactoryBean"
          lazy-init="false">
          <property name="applicationContextSchedulerContextKey"
                         value="applicationContext" />
          <property name="startupDelay" value="90" />
          <property name="transactionManager" ref="transactionManager" />
          <property name="overwriteExistingJobs" value="true" />
          <property name="autoStartup" value="true" />
          <property name="dataSource" ref="pooledDS" />
          <property name="quartzProperties">
                 <props>
                       <prop key="org.quartz.scheduler.instanceName">Scheduler_MyJob</prop>
                       <prop key="org.quartz.scheduler.instanceId">AUTO</prop>
                       <prop key="org.quartz.jobStore.misfireThreshold">864000000</prop>
                       <prop key="org.quartz.jobStore.class">
                              org.quartz.impl.jdbcjobstore.JobStoreCMT
                       </prop>
                       <prop key="org.quartz.jobStore.driverDelegateClass">
                              org.quartz.impl.jdbcjobstore.oracle.OracleDelegate
                       </prop>
                       <prop key="org.quartz.jobStore.tablePrefix"> DWDATA.MY_QRTZ_</prop>  
                       <prop key="org.quartz.jobStore.isClustered">true</prop>
                       <prop key="org.quartz.jobStore.clusterCheckinInterval">20000</prop>
                       <prop key="org.quartz.jobStore.acquireTriggersWithinLock">true</prop>
                       <prop key="org.quartz.threadPool.class">org.quartz.simpl.SimpleThreadPool</prop>
                       <prop key="org.quartz.threadPool.threadCount">4</prop>
                       <prop key="org.quartz.threadPool.threadPriority">5</prop>
                 </props>
          </property>
   </bean>

我已经尝试清空数据库(Oracle)中的QUARTZ表,并确保没有其他应用程序实例运行(这是在我们的开发环境中,所有开发人员可能在本地运行但是针对共享数据库)。

我尝试添加TriggerListener和JobListener,但是在调用它们之前会发生此错误(它们适用于未发生错误的实例)。

每次提交作业时都不会发生错误,错误发生后请求会很好。似乎没有一种模式。

我确定我错过了一些简单的东西,所以我希望有人知道这个错误,并且可以提供解决方案。

0 个答案:

没有答案