Quartz Job触发时不会启动速度

时间:2012-08-30 10:12:13

标签: spring quartz-scheduler velocity

Velocity Engine正在我的项目中用于发送有关用户操作和作业触发的邮件。

虽然根据用户操作发送的邮件非常好,但是有时会收到作业发送的邮件内容为空。这是非常随机的,我似乎无法将其与任何原因联系起来。发生这种情况时没有错误日志。 (在添加NullLogChute属性之前,我确实得到了Velocity无法初始化错误。我被告知这将解决异常,但它所做的就是阻止异常出现在日志中。邮件仍然是空的内容)请帮忙!

早期例外:

ERROR 2012-07-29 05:00:00,219 com.myProject.util.VelocityUtil - Velocity could not be initialized!
java.lang.RuntimeException: Velocity could not be initialized!
..
..
Caused by: org.apache.velocity.exception.VelocityException: Failed to initialize an instance of org.apache.velocity.runtime.log.AvalonLogChute with the current runtime configuration.

我在spring servlet xml中设置了速度配置属性:

<bean id="velocityUtil" class="com.myProject.util.VelocityUtil" >
 <property name="velocityConfiguration">
  <props> 
   <prop key="resource.loader">class</prop>
   <prop key="class.resource.loader.class">org.apache.velocity.runtime.resource.loader.ClasspathResourceLoader</prop>
   <prop key="runtime.log.logsystem.class">org.apache.velocity.runtime.log.NullLogChute</prop> 
  </props>
 </property>

在spring servlet中设置的Quartz属性:

<bean class="org.springframework.scheduling.quartz.SchedulerFactoryBean">
    <property name="applicationContextSchedulerContextKey"><value>applicationContext</value></property>
     <property name="quartzProperties">
        <props> 
            <prop key="org.quartz.scheduler.instanceName">Quartz</prop> 
            <prop key="org.quartz.scheduler.instanceId">AUTO</prop> 
            <prop key="org.quartz.scheduler.rmi.export">false</prop> 
            <prop key="org.quartz.scheduler.rmi.proxy">false</prop> 
            <prop key="org.quartz.threadPool.class">org.quartz.simpl.SimpleThreadPool</prop> 
            <prop key="org.quartz.threadPool.threadCount">5</prop> 
            <prop key="org.quartz.threadPool.threadPriority">1</prop> 
            <prop key="org.quartz.jobStore.class">org.quartz.impl.jdbcjobstore.JobStoreTX</prop> 
            <prop key="org.quartz.jobStore.tablePrefix">EES.QRTZ_</prop> 
            <prop key="org.quartz.jobStore.isClustered">true</prop> 
            <prop key="org.quartz.jobStore.misfireThreshold">60000</prop> 
            <prop key="org.quartz.jobStore.driverDelegateClass">org.quartz.impl.jdbcjobstore.MSSQLDelegate</prop>
        </props>
      </property>
    <property name="dataSource">
        <ref bean="dataSource" />
    </property>
    <property name="triggers">
    <list>
        <ref bean="Mod1CronTrigger" />
        <ref bean="Mod2CronTrigger" />
        <ref bean="Mod3CronTrigger" />
        <ref bean="Mod4CronTrigger" /> 
        <ref bean="Mod5CronTrigger" /> 
        <ref bean="Mod6CronTrigger" />
    </list>
    </property>
</bean>

<list>中的每个触发器都定义了jobDetail和CronExpression。例如,

<bean id="Mod1CronTrigger" class="org.springframework.scheduling.quartz.CronTriggerBean">
    <property name="jobDetail" ref="Mod1Job"/>
    <property name="cronExpression" value="0 30 3 1/1 * ? *"/>
</bean>

<bean name="Mod1Job" class="org.springframework.scheduling.quartz.JobDetailBean">
    <property name="jobClass" value="com.myProject.jobs.Mod1Job" />
    <property name="name" value="Mod1Job" />
</bean>

0 个答案:

没有答案