views:

56

answers:

2

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"&gt;
<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

A: 

I forgot the following entry:

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

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?

serg
not sure how it ran without adding the triggers property, unless you did that by default, that was what I was missing
walnutmon