2011-07-27 36 views
0

我使用石英1.5.2與彈簧3.0.5版本。當我嘗試使用jdbc store type quartz獲取調度程序上下文時,我正面臨着NotSerializableException。我已經完成了我的研究,以完成它,但我無法克服它。我沒有想法。石英NotSerializableException異常

這是調度程序配置。

<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="taskExecutor" 
     class="org.springframework.scheduling.concurrent.ThreadPoolTaskExecutor"> 
    <property name="corePoolSize"> 
     <value>${middleware.taskExecutor.corePoolSize}</value> 
    </property> 
    <property name="maxPoolSize"> 
     <value>${middleware.taskExecutor.maxPoolSize}</value> 
    </property> 
    <property name="queueCapacity"> 
     <value>${middleware.taskExecutor.queueCapacity}</value> 
    </property> 
</bean> 

<bean id="emailService" class="EmailServiceImpl"> 
</bean>  

<bean id="emailSenderTrigger" class="org.springframework.scheduling.quartz.SimpleTriggerBean"> 
    <property name="jobDetail" ref="emailSenderJob"/> 
    <property name="startDelay"> 
     <value>${middleware.portingTrigger.startDelay}</value> 
    </property> 
    <property name="repeatInterval"> 
     <value>${middleware.portingTrigger.repeatInterval}</value> 
    </property> 
</bean> 

<bean id="emailSenderJob" class="org.springframework.scheduling.quartz.JobDetailBean"> 
    <property name="jobClass" value="com.alcatel.lucent.tr.yoda.middleware.job.EmailSenderJob"/> 
    <property name="jobDataAsMap"> 
     <map> 
      <entry key="taskExecuter" value-ref="taskExecutor"/> 
      <entry key="emailService"> 
       <ref bean="emailService"/> 
      </entry> 
     </map> 
    </property> 
</bean> 

<bean id="scheduler" class="org.springframework.scheduling.quartz.SchedulerFactoryBean"> 
    <property name="schedulerContextAsMap"> 
     <map> 
      <entry key="emailService"> 
       <ref bean="emailService"/> 
      </entry> 
     </map> 
    </property> 
    <property name="autoStartup" value="true"/> 
    <property name="triggers"> 
     <list> 
      <ref bean="emailSenderTrigger"/> 
     </list> 
    </property> 
    <property name="quartzProperties"> 
     <props> 
      <prop key="org.quartz.scheduler.instanceName">DefaultQuartzScheduler</prop> 
      <prop key="org.quartz.scheduler.rmi.export">false</prop> 
      <prop key="org.quartz.scheduler.rmi.proxy">false</prop> 
      <prop key="org.quartz.scheduler.xaTransacted">false</prop> 
      <prop key="org.quartz.threadPool.class">org.quartz.simpl.SimpleThreadPool</prop> 
      <prop key="org.quartz.threadPool.threadCount">5</prop> 
      <prop key="org.quartz.threadPool.threadPriority">4</prop> 
      <prop key="org.quartz.jobStore.class">org.quartz.impl.jdbcjobstore.JobStoreCMT</prop> 
      <!--<prop key="org.quartz.jobStore.class">org.quartz.simpl.RAMJobStore</prop>--> 
      <prop key="org.quartz.jobStore.driverDelegateClass">org.quartz.impl.jdbcjobstore.StdJDBCDelegate</prop> 
      <prop key="org.quartz.jobStore.dataSource">QUARTZ</prop> 
      <prop key="org.quartz.jobStore.tablePrefix">QRTZ_</prop> 
      <prop key="org.quartz.jobStore.nonManagedTXDataSource">QUARTZ_NO_TX</prop> 
      <prop key="org.quartz.dataSource.QUARTZ.jndiURL">java:QuartzDS</prop> 
      <prop key="org.quartz.dataSource.QUARTZ_NO_TX.jndiURL">java:QuartzNoTxDS</prop> 
     </props> 
    </property> 
</bean> 

我應該怎麼辦?提前致謝。

回答

0

EmailSenderJob及其所有成員都需要實現Serializable。

+0

我猜它的EmailServiceImpl類應該實現Serializable接口,因爲它作爲jobDataAsMap條目傳遞。 – Waqas

+0

我試圖序列化他們兩個,但沒有成功。我仍然得到相同的錯誤。 – MartK

+0

@MartK可以請你發佈你收到的例外嗎? – Waqas