<bean id="jobDetail" class="org.springframework.scheduling.quartz.JobDetailBean">
        <!--shouldRecover属性为true,则当Quartz服务被中止后,再次启动任务时会尝试恢复执行之前未完成的所有任务-->
        <property name="jobClass">
         <value>com.richway.quartz.test.HelloWorld</value>
        </property>
        <property name="jobDataAsMap">
<map>
<entry key="simpleService">
<ref bean="simpleService" />
</entry>
</map>
</property>
        
    </bean>   
这里面的simpleService明明已经实现了serializable接口,可是后台为啥还报错:
Couldn't store job: Unable to serialize JobDataMap for insertion into database because the value of property 'simpleService' is not serializable: org.springframework.beans.factory.support.DefaultListableBeanFactory [See nested exception: java.io.NotSerializableException: Unable to serialize JobDataMap for insertion into database because the value of property 'simpleService' is not serializable: org.springframework.beans.factory.support.DefaultListableBeanFactory]springquartz

解决方案 »

  1.   

    package com.richway.quartz.service;import java.io.Serializable;
    import java.util.Date;import org.apache.commons.logging.Log;
    import org.apache.commons.logging.LogFactory;
    public class SimpleService implements Serializable{ /**
     * 
     */
    private static final long serialVersionUID = 1319673450675993416L;
    /**
     * 
     */
    private static Log logger = LogFactory.getLog(SimpleService.class);//日志记录器 
         
        public void testMethod(String name){    
            //这里执行定时调度业务    
            logger.info("当前时间:"+new Date());    
        }    
            
        public void testMethod2(){    
            logger.info("testMethod2");    
        }    }
      

  2.   

    参考别人写的看看http://sloanseaman.com/wordpress/2011/06/06/spring-and-quartz-and-persistence/
      

  3.   

    不对,去掉序列化以后,报错显示的是那个service没有序列化,加上以后是这个类
    org.springframework.beans.factory.support.DefaultListableBeanFactory
      

  4.   

    换那个jar包,spring的还是quartz?
      

  5.   

    quartz 跟spring整合的时候 好像不能用1.8.x版本的你用quartz 1.7.3版本的试试。
      

  6.   

    貌似我找到方法了,我原来显示报错是 org.springframework.beans.factory.support.DefaultListableBeanFactory这个类没有序列化,这个类是spring架包里面的一个类,我观察了一下spring3.0的jar包,发现里面的这个类实现序列化接口了,之前版本好像都没实现,spring换成3.0就能运行了。多谢各位了