2010-04-15 69 views
2

我使用QuartzJobBean为了在我的春天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!!!"); 
    } 
} 

设置这个东西后,我没有看到的System.out在我的web控制台

我跑宁这个地方上OC4J通过JDeveloper中

回答

3

我忘了下面的条目:

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

我运行你的代码,并得到了触发,这样的问题是其他地方。

你的项目中是否有quartz-all-x.x.x.jar?你在appContext.xml中做了这些吗?

+0

不确定它如何在没有添加触发器属性的情况下运行,除非您默认这样做,那正是我所缺少的 – walnutmon 2010-04-20 14:09:53