开发者

Quartz NotSerializableException Exception

开发者 https://www.devze.com 2023-03-23 09:00 出处:网络
Im using quartz 1.5.2 with spring 3.0.5 version. When i try to get the scheduler context with jdbc store type quartz, im facing NotSerializableException. I have done my research to get it done but i c

Im using quartz 1.5.2 with spring 3.0.5 version. When i try to get the scheduler context with jdbc store type quartz, im facing NotSerializableException. I have done my research to get it done but i couldnt managed to get over it. Im out of ideas.

Here is the scheduler configuration.

<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.r开发者_JAVA百科mi.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>

What should i do? Thanks in advance.


Use inner classes. No serialization is required. http://shyarmal.blogspot.com/2011/07/quartz-20-schedule-cron-with-spring.html


EmailSenderJob and all of its members need to implement Serializable.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号