小男孩‘自慰网亚洲一区二区,亚洲一级在线播放毛片,亚洲中文字幕av每天更新,黄aⅴ永久免费无码,91成人午夜在线精品,色网站免费在线观看,亚洲欧洲wwwww在线观看

分享

解決Spring中使用quartz發(fā)生NotSerializableException methodInvoker的問題

 風_宇星 2015-05-24

Spring2.5 + quartz1.6.5 發(fā)生如下異常

 

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./browse/SPR-3797
下載BeanInvokingJobDetailFactoryBean.java 和 MethodInvokingJobDetailFactoryBean.java
在Spring配置文件中使用如下方式

 

Xml代碼  收藏代碼
  1. <bean id="exampleBean" class="example.ExampleImpl">   
  2. </bean>  
  3.   
  4. <bean id="exampleTrigger" class="org.springframework.scheduling.quartz.CronTriggerBean">   
  5.     <!-- Execute exampleBean.fooBar() at 2am every day -->  
  6.     <property name="cronExpression" value="0 0 2 * * ?" />  
  7.     <property name="jobDetail">   
  8.         <bean class="frameworkx.springframework.scheduling.quartz.BeanInvokingJobDetailFactoryBean">   
  9.             <property name="concurrent" value="false"/>  
  10.             <property name="targetBean" value="exampleBean" />  
  11.             <property name="targetMethod" value="fooBar" />  
  12.             <property name="arguments">   
  13.                 <list>   
  14.                     <value>arg1Value</value>  
  15.                     <value>arg2Value</value>   
  16.                 <list>   
  17.             </property>   
  18.         </bean>   
  19.     </property>   
  20. </bean>   
  21.   
  22. <bean class="org.springframework.scheduling.quartz.SchedulerFactoryBean">   
  23.     <property name="triggers">   
  24.         <list>   
  25.             <ref bean="exampleTrigger" />   
  26.         </list>   
  27.     </property>   
  28. </bean>  
 

附件是BeanInvokingJobDetailFactoryBean.java 和 MethodInvokingJobDetailFactoryBean.java

 

參考 http://soulshard./blog/337886

    本站是提供個人知識管理的網(wǎng)絡存儲空間,所有內(nèi)容均由用戶發(fā)布,不代表本站觀點。請注意甄別內(nèi)容中的聯(lián)系方式、誘導購買等信息,謹防詐騙。如發(fā)現(xiàn)有害或侵權內(nèi)容,請點擊一鍵舉報。
    轉藏 分享 獻花(0

    0條評論

    發(fā)表

    請遵守用戶 評論公約

    類似文章 更多