我使用石英1.5.2与弹簧3.0.5版本。当我尝试使用jdbc存储类型quartz获取调度程序上下文时,我面临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 :(得分:2)
答案 1 :(得分:0)
EmailSenderJob及其所有成员都需要实现Serializable。