使用Spring + quartz集群持久化时注意事项
来源:互联网 发布:pxe网络启动winpe 编辑:程序博客网 时间:2024/05/21 03:25
1、持久化时未序列化异常
2.持久化时jobDetail找不到
原因一般是数据源配置导致的问题。
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
例如:
<bean id="studyDetail" class="org.springframework.scheduling.quartz.MethodInvokingJobDetailFactoryBean"> <property name="targetObject"> <ref bean="studyJob" /> </property> <property name="targetMethod"> <value>doSth</value> </property> </bean>
原因请看org.springframework.scheduling.quartz.MethodInvokingJobDetailFactoryBean
NOTE: JobDetails created via this FactoryBean are not serializable and thus not suitable for persistent job stores. You need to implement your own Quartz Job as a thin wrapper for each case where you want a persistent job to delegate to a specific service method.Compatible with Quartz 1.5+ as well as Quartz 2.0-2.2, as of Spring 3.2.
所以对于持久化的job需要自己继承org.springframework.scheduling.quartz.QuartzJobBean,同时修改JobDetailFactoryBean为
<bean id="studyDetail"class="org.springframework.scheduling.quartz.JobDetailFactoryBean"><property name="jobClass"><value>com.joshua.job.StudyJob</value></property><property name="name" value="studyDetail"></property><property name="durability" value="true" /></bean>
2.持久化时jobDetail找不到
org.quartz.JobPersistenceException: The job (DEFAULT.studyDetail) referenced by the trigger does not exist.
原因一般是数据源配置导致的问题。
可能的原因是:数据源未配置成自动提交,当第一次启动trigger时,之前对数据库的job的增加的事物没有自动提交,导致后面的事物无法查询到。
如果数据源是通过dbcp配置的将自动提交配置为true
<property name="defaultAutoCommit" value="false" />如果是c3p0配置为autoCommitOnClose=true
0 0
- 使用Spring + quartz集群持久化时注意事项
- 使用Spring + quartz集群持久化时注意事项
- spring整合quartz持久化
- 使用spring quartz 进行持久化的任务调度
- spring整合quartz并持久化
- spring整合quartz并持久化
- Spring下quartz调度持久化实战
- spring集成quartz持久化简单应用
- Spring下quartz调度持久化实战
- spring整合quartz并持久化
- spring整合quartz并持久化
- spring整合quartz并持久化
- 【Quartz】Quartz存储与持久化-基于Spring的配置
- 【Quartz】Quartz存储与持久化-基于Spring的配置
- Quartz.net持久化与集群部署开发详解
- Quartz.net持久化与集群部署开发详解
- spring中使用quartz框架(持久化到数据库+springboot)
- Spring+Quartz tomcat集群
- Communication Patterns
- uva 297
- 番茄工作法中所提到的低效现象
- POJ1256--全排列
- 栈内存的临时性不能返回局部变量地址
- 使用Spring + quartz集群持久化时注意事项
- 面向对象的比较
- 剑指offer - 从上往下遍历二叉树
- Java 构建二叉树
- hdu5489 Removed Interval
- 笔试题:背包问题代码实现
- iOS中消息的传递机制
- 为应用添加搜索功能
- 树和二叉树