<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans-2.0.xsd">
<!-- <bean id="tjob" class="com.test.quartz.TestJob"> </bean>-->
<!--job-->
<!-- <bean id="job"-->
<!-- class="org.springframework.scheduling.quartz.JobDetailBean">-->
<!-- <property name="jobClass">-->
<!-- <value>com.test.quartz.TestJob </value>-->
<!-- </property>-->
<!-- <property name="jobDataAsMap">-->
<!-- <map>-->
<!-- <entry key="timeout">-->
<!-- <value>5 </value>-->
<!-- </entry>-->
<!-- </map>-->
<!-- </property>-->
<!-- </bean>-->
<bean id="job"
class="org.springframework.scheduling.quartz.MethodInvokingJobDetailFactoryBean">
<property name="targetObject" ref="tjob"> </property>
<property name="targetMethod">
<value>print </value>
</property>
<property name="concurrent" value="false"> </property>
<property name="jobDataAsMap">
<map>
<entry key="timeout">
<value>5 </value>
</entry>
</map>
</property>
</bean>
<!--tigger -->
<bean id="crontigger"
class="org.springframework.scheduling.quartz.CronTriggerBean">
<property name="jobDetail" ref="job"> </property>
<property name="cronExpression">
<value>* 4,5,6,7 15 * * ? </value>
</property>
</bean>
<!--scheduling -->
<bean autowire="no" lazy-init="false"
class="org.springframework.scheduling.quartz.SchedulerFactoryBean">
<property name="triggers">
<list>
<ref local="crontigger" />
</list>
</property>
<property name="quartzProperties">
<props>
<prop key="org.quartz.threadPool.class">
org.quartz.simpl.SimpleThreadPool
</prop>
<prop key="org.quartz.threadPool.threadCount">10 </prop>
<prop key="org.quartz.threadPool.class">
org.quartz.simpl.SimpleThreadPool
</prop>
<!-- <prop key="org.quartz.threadPool.threadPriority">-->
<!-- 5-->
<!-- </prop>-->
<!-- <prop-->
<!-- key="org.quartz.threadPool.threadsInheritContextClassLoaderOfInitializingThread">-->
<!-- true-->
<!-- </prop>-->
<!-- <prop key="org.quartz.threadPool.threadCount">10 </prop>-->
<!---->
<!-- <prop key="org.quartz.jobStore.class">-->
<!-- org.quartz.impl.jdbcjobstore.JobStoreTX-->
<!-- </prop>-->
<!-- <prop key="org.quartz.jobStore.tablePrefix">QRTZ_ </prop>-->
<!-- <prop key="org.quartz.jobStore.driverDelegateClass">-->
<!-- org.quartz.impl.jdbcjobstore.StdJDBCDelegate-->
<!-- </prop>-->
<!-- <prop key="org.quartz.jobStore.dataSource">qzDS </prop>-->
<!---->
<!-- <prop key="org.quartz.dataSource.qzDS.driver">-->
<!-- com.mysql.jdbc.Driver-->
<!-- </prop>-->
<!-- <prop key="org.quartz.dataSource.qzDS.URL">-->
<!-- jdbc:mysql://localhost:3306/qrtz-->
<!-- </prop>-->
<!-- <prop key="org.quartz.dataSource.qzDS.user">root </prop>-->
<!-- <prop key="org.quartz.dataSource.qzDS.password">-->
<!-- root-->
<!-- </prop>-->
<!-- <prop key="org.quartz.dataSource.qzDS.maxConnections">-->
<!-- 30-->
<!-- </prop>-->
</props>
</property>
<property name="configLocation"
value="/WEB-INF/quartz.properties">
</property>
<!-- quartz.properties的配置跟上面注释的一样-->
</bean>
</beans>
错误提示为:
严重: Exception sending context initialized event to listener instance of class org.springframework.web.context.ContextLoaderListener
org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'org.springframework.scheduling.quartz.SchedulerFactoryBean' defined in ServletContext resource [/WEB-INF/applicationContext.xml]: Invocation of init method failed; nested exception is org.quartz.JobPersistenceException: Couldn't store job: Unable to serialize JobDataMap for insertion into database because the value of property 'methodInvoker' is not serializable: org.springframework.scheduling.quartz.MethodInvokingJobDetailFactoryBean [See nested exception: java.io.NotSerializableException: Unable to serialize JobDataMap for insertion into database because the value of property 'methodInvoker' is not serializable: org.springframework.scheduling.quartz.MethodInvokingJobDetailFactoryBean]
Caused by: org.quartz.JobPersistenceException: Couldn't store job: Unable to serialize JobDataMap for insertion into database because the value of property 'methodInvoker' is not serializable: org.springframework.scheduling.quartz.MethodInvokingJobDetailFactoryBean [See nested exception: java.io.NotSerializableException: Unable to serialize JobDataMap for insertion into database because the value of property 'methodInvoker' is not serializable: org.springframework.scheduling.quartz.MethodInvokingJobDetailFactoryBean]