Quartz 未运行的 Spring 任务
我正在使用 QuartzJobBean 来在我的 Spring Web 应用程序中运行任务,
我的 xml 中包含:
<?xml version="1.0" encoding="UTF-8"?><!DOCTYPE beans PUBLIC "-//SPRING//DTD BEAN 2.0//EN" "http://www.springframework.org/dtd/spring-beans-2.0.dtd">
<beans>
<bean id="siteMapGeneratorJob" class="org.springframework.scheduling.quartz.JobDetailBean">
<property name="jobClass" value="com.job.SiteMapJob" />
<!--<property name="jobDataAsMap"></property>-->
</bean>
<bean id="simpleSiteMapTrigger" class="org.springframework.scheduling.quartz.SimpleTriggerBean">
<property name="jobDetail" ref="siteMapGeneratorJob"/>
<property name="startDelay" value="10000"/>
<property name="repeatInterval" value="30000"/>
</bean>
</beans>
我的 bean 类:
package com.job;
import org.quartz.JobExecutionContext;
import org.springframework.scheduling.quartz.QuartzJobBean;
public class SiteMapJob extends QuartzJobBean {
public SiteMapJob() {
}
protected void executeInternal(JobExecutionContext jobExecutionContext) {
System.out.println("This is my scheduled Task!!!");
}
}
在 Web 控制台中看不到 system.out
设置完这些内容后,我 通过 JDeveloper 在 OC4J 上本地运行
I'm using the QuartzJobBean in order to run a task in my spring web application
my xml which is being included:
<?xml version="1.0" encoding="UTF-8"?><!DOCTYPE beans PUBLIC "-//SPRING//DTD BEAN 2.0//EN" "http://www.springframework.org/dtd/spring-beans-2.0.dtd">
<beans>
<bean id="siteMapGeneratorJob" class="org.springframework.scheduling.quartz.JobDetailBean">
<property name="jobClass" value="com.job.SiteMapJob" />
<!--<property name="jobDataAsMap"></property>-->
</bean>
<bean id="simpleSiteMapTrigger" class="org.springframework.scheduling.quartz.SimpleTriggerBean">
<property name="jobDetail" ref="siteMapGeneratorJob"/>
<property name="startDelay" value="10000"/>
<property name="repeatInterval" value="30000"/>
</bean>
</beans>
my bean class:
package com.job;
import org.quartz.JobExecutionContext;
import org.springframework.scheduling.quartz.QuartzJobBean;
public class SiteMapJob extends QuartzJobBean {
public SiteMapJob() {
}
protected void executeInternal(JobExecutionContext jobExecutionContext) {
System.out.println("This is my scheduled Task!!!");
}
}
After setting this stuff up, I'm not seeing the system.out in my web console
I'm running this locally on OC4J through JDeveloper
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
我忘记了以下条目:
I forgot the following entry:
我运行你的代码,它被触发了,所以问题出在其他地方。
你的项目中有quartz-all-xxxjar吗?您是否在 appContext.xml 中执行所有这些操作?
I run your code and it got triggered, so problem is somewhere else.
Do you have quartz-all-x.x.x.jar in your project? And are you doing all this in appContext.xml?