使用 Spring 框架的 Quartz JobStore
我正在使用 Spring 框架在 Oracle DB 上实现 Quartz Job Store。 我的 ApplicationContext.xml 如下
<bean id="driverJob" class="org.springframework.scheduling.quartz.JobDetailBean">
<property name="jobClass" value="BatchFileCollector" />
</bean>
<bean id="ranchTrigger" class="org.springframework.scheduling.quartz.SimpleTriggerBean">
<property name="jobDetail" ref="driverJob" />
<property name="startDelay" value="2000" />
<property name="repeatInterval" value="10000" />
</bean>
<bean class="org.springframework.scheduling.quartz.SchedulerFactoryBean">
<property name="triggers">
<list>
<ref bean="ranchTrigger" />
</list>
</property>
<property name="dataSource">
<ref bean="dataSource.TEXAN"/>
</property>
<property name="applicationContextSchedulerContextKey">
<value>applicationContext</value>
</property>
<property name="autoStartup">
<value>true</value>
</property>
<property name="configLocation" value="classpath:quartz.properties"/>
</bean>
此配置给了我以下错误。
Caused by: org.quartz.JobPersistenceException:
Couldn't store trigger: The job (DEFAULT.driverJob) referenced by the trigger does not exist.
[See nested exception: org.quartz.JobPersistenceException: The job (DEFAULT.driverJob) referenced by the trigger does not exist.]
我正在使用 Spring 框架 2.5.6。 我必须升级我的 Quartz 版本吗? 我找不到问题所在。
感谢您的帮助。
I am implementing Quartz Job Store on Oracle DB using Spring Framework. My ApplicationContext.xml is below
<bean id="driverJob" class="org.springframework.scheduling.quartz.JobDetailBean">
<property name="jobClass" value="BatchFileCollector" />
</bean>
<bean id="ranchTrigger" class="org.springframework.scheduling.quartz.SimpleTriggerBean">
<property name="jobDetail" ref="driverJob" />
<property name="startDelay" value="2000" />
<property name="repeatInterval" value="10000" />
</bean>
<bean class="org.springframework.scheduling.quartz.SchedulerFactoryBean">
<property name="triggers">
<list>
<ref bean="ranchTrigger" />
</list>
</property>
<property name="dataSource">
<ref bean="dataSource.TEXAN"/>
</property>
<property name="applicationContextSchedulerContextKey">
<value>applicationContext</value>
</property>
<property name="autoStartup">
<value>true</value>
</property>
<property name="configLocation" value="classpath:quartz.properties"/>
</bean>
This configuration gives me the below error.
Caused by: org.quartz.JobPersistenceException:
Couldn't store trigger: The job (DEFAULT.driverJob) referenced by the trigger does not exist.
[See nested exception: org.quartz.JobPersistenceException: The job (DEFAULT.driverJob) referenced by the trigger does not exist.]
I am using Spring Framework 2.5.6. Do I have to upgrade my Quartz version?
I cannot find the problem.
Thanks for your help.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
您的 SchedulerFactoryBean 还需要注册“driverJob”。 除了触发器之外,还添加 jobDetails 列表。
Your SchedulerFactoryBean needs to have the "driverJob" registered, too. Along with your triggers, add a list of jobDetails.
我对 Quartz 1.5.2 和 Spring 3.0.4 也有同样的问题。 问题在于 JobStoreSupport 类尝试存储带有作业外键的 cron 触发器(尝试从数据库加载作业),但该触发器尚未持久化。
quartz 1.6.1、1.7.2 版本也有同样的问题。
I have the same problem with Quartz 1.5.2 and Spring 3.0.4. The problem is that the JobStoreSupport class tries to store a cron trigger with a foreign key to the job (tries to load the job from the db), which is not persisted yet.
Same problem with quartz 1.6.1, 1.7.2 versions.
我不确定这是否有效,但您可以尝试使用:
而不是:
I'm not sure if this will work, but you could try using:
instead of: