开发者

Spring Task with Quartz Not Running

开发者 https://www.devze.com 2022-12-26 19:03 出处:网络
I\'m using the QuartzJobBean in order to run a task in my spring web application my xml which is being included:

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


I forgot the following entry:

<bean class="org.springframework.scheduling.quartz.SchedulerFactoryBean">
    <property name="triggers">
        <list>
            <ref bean="simpleSiteMapTrigger"/>
        </list>
    </property>
</bean>


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?

0

精彩评论

暂无评论...
验证码 换一张
取 消