解决Spring中使用quartz发生NotSerializableException methodInvoker的问题

阅读更多

Spring2.5 + quartz1.6.5 发生如下异常

 

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]
        at org.quartz.impl.jdbcjobstore.JobStoreSupport.storeJob(JobStoreSupport.java:1105)

 

这是Spring的Bug, 解决方法 http://jira.springframework.org/browse/SPR-3797
下载BeanInvokingJobDetailFactoryBean.java 和 MethodInvokingJobDetailFactoryBean.java
在Spring配置文件中使用如下方式

 

 


 
	
	
	 
		 
			
			
			
			 
				 
					arg1Value
					arg2Value 
				 
			 
		 
	 
 

 
	 
		 
			 
		 
	 
 

附件是BeanInvokingJobDetailFactoryBean.java 和 MethodInvokingJobDetailFactoryBean.java

 

参考 http://soulshard.iteye.com/blog/337886

  • class.zip (9.8 KB)
  • 下载次数: 1170

你可能感兴趣的:(quartz,Spring,Bean,Java,Blog)