日期:2014-05-17  浏览次数:20744 次

求助:spring配置quartz持久化问题
我使用spring的quartz进行任务调度,为了保存已经配置的调度任务,因此进行了任务的相关配置,但是发现每次配置的job仍然是在ram里面,并没有持久化到对应的表里面,重新启动后上次配置的任务便消失了。配置如下(由于涉及到保密,路径名称进行了隐藏,*代替):

bean配置:
<bean id="quartzSchedulerFactory" lazy-init="false" class="com.*.scheduling.quartz.SchedulerFactoryBean">
  <property name="configLocation" value="/WEB-INF/modules/*_SysMgr.com/conf/quartz.properties"/>
  <property name="dataSource" ref="database_dataSource"/>
  <property name="autoStartup" value="true"/>
  </bean>
  <bean id="schedulerService" class="com.*.device.customtimer.service.SchedulerServiceImpl">
  <property name="scheduler" ref="quartzSchedulerFactory"/>
  </bean>
  <bean id="cac-sysmgr-dbtask-factory" class="com.*.dbmgr.domain.model.task.DBTaskFactory">
  <property name="schedulerService" ref="schedulerService"/>
  </bean>

datdasource配置:
<bean id="dbproperties"
class="com.×.beans.factory.config.PropertyPlaceholderConfigurer">
<property name="location">
<value>classpath:db.properties</value>
</property>
</bean>
<bean id="dataSource"
class="org.apache.commons.dbcp.BasicDataSource"
destroy-method="close">
<property name="driverClassName"
value="${db.driverClassName}" />
<property name="url"
value="${db.url}:${db.port};databaseName=CAC_DB" />
<property name="username" value="${db.username}" />
<property name="password" value="${db.password}" />
<property name="initialSize" value="2" />
<property name="maxActive" value="20" />
<property name="maxWait" value="-1" />
<property name="maxIdle" value="10" />
<property name="removeAbandoned" value="true" />
<property name="removeAbandonedTimeout" value="30000" />
<property name="logAbandoned" value="true" />
</bean>

<bean id="sessionFactory" class="com.×.orm.zorm.LocalSessionFactoryBean">
<property name="dataSource" ref="dataSource"/>
<property name="mappingLocations">
<list>
<value>classpath:com/×/**/*.hbm.xml</value>
</list>
</property>
<property name="mappingJarLocations">
<list>
<value>WEB-INF/**/CAC_*.jar</value>
</list>
</property>
<property name="zormProperties">
<props>
<prop key="zorm.dialect">
com.×.zorm.dialect.SQLServerDialect
</prop>
<prop key="zorm.show_sql">true</prop>
</props>
</property>
</bean>
quartz配置:
#org.quartz.jobStore.class = org.quartz.impl.jdbcjobstore.JobStoreTX 
org.quartz.jobStore.class = org.quartz.impl.jdbcjobstore.JobStoreTX 
org.quartz.jobStore.driverDelegateClass = org.quartz.impl.jdbcjobstore.MSSQLDelegate
org.quartz.jobStore.tablePrefix = QRTZ_
org.quartz.jobStore.misfireThreshold = 60000
org.quartz.jobStore.maxMisfiresToHandleAtATime = 20<