Quartz JDBCStore 和MethodInvokingJobDetailFactoryBean冲突的问题Note: JobDetails created via this F
Quartz JDBCStore 和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."
M类上有这么一句 但是怎么做这种thin wrapper呢?
BO..
查API 确实有如此这段note 说jobDetails未序列化 需要对Quartz Job简单包装
如何包装
从google 又获得信息如下
http://opensource.atlassian.com/projects/spring/browse/SPR-2462?page=all&decorator=printable
大概意思就是是否能把持久化的和临时的Jobs分开 还提到了setDurability(boolean durability)
现在就看看这个方法
不过思路有点混乱 需要被包装是哪个类?protected JobDetail retrieveJob(Connection conn, SchedulingContext ctxt, String jobName, String groupName) throws JobPersistenceException { try { JobDetail job = getDelegate().selectJobDetail(conn, jobName, groupName, getClassLoadHelper()); if (job != null) { String[] listeners = getDelegate().selectJobListeners(conn, jobName, groupName); for (int i = 0; i < listeners.length; ++i) { job.addJobListener(listeners[i]); } } return job; } catch (ClassNotFoundException e) { throw new JobPersistenceException( "Couldn't retrieve job because a required class was not found: " + e.getMessage(), e, SchedulerException.ERR_PERSISTENCE_JOB_DOES_NOT_EXIST); } catch (IOException e) { throw new JobPersistenceException( "Couldn't retrieve job because the BLOB couldn't be deserialized: " + e.getMessage(), e, SchedulerException.ERR_PERSISTENCE_JOB_DOES_NOT_EXIST); } catch (SQLException e) { throw new JobPersistenceException("Couldn't retrieve job: " + e.getMessage(), e); } } 18 楼 huangpengxiao 2006-11-30 重启之后又回到
Couldn't store trigger: It does not make sense to associate a non-volatile Trigger with a volatile Job!
郁闷了 换换脑子搞点别的 19 楼 huangpengxiao 2006-11-30 顶 有用过的没 帮忙啊 20 楼 skyfly2424 2007-06-13 我也遇到了这个问题,刚解决了, 发现quartz.properties文件中使用了
org.quartz.jobStore.class = org.quartz.impl.jdbcjobstore.JobStoreTX
#org.quartz.jobStore.class = org.quartz.impl.jdbcjobstore.JobStoreCMT
#org.quartz.jobStore.driverDelegateClass = org.quartz.impl.jdbcjobstore.StdJDBCDelegate
org.quartz.jobStore.driverDelegateClass = org.quartz.impl.jdbcjobstore.MSSQLDelegate
#org.quartz.jobStore.driverDelegateClass = org.quartz.impl.jdbcjobstore.oracle.OracleDelegate
org.quartz.jobStore.useProperties = false
org.quartz.jobStore.dataSource = myDS
org.quartz.jobStore.tablePrefix = QRTZ_
org.quartz.jobStore.isClustered = false
这些配置,他会把JOB保存到数据库中, 所以要序列化 ,注释掉就OK了 21 楼 huangpengxiao 2007-06-13 skyfly2424 写道我也遇到了这个问题,刚解决了, 发现quartz.properties文件中使用了
org.quartz.jobStore.class = org.quartz.impl.jdbcjobstore.JobStoreTX
#org.quartz.jobStore.class = org.quartz.impl.jdbcjobstore.JobStoreCMT
#org.quartz.jobStore.driverDelegateClass = org.quartz.impl.jdbcjobstore.StdJDBCDelegate
org.quartz.jobStore.driverDelegateClass = org.quartz.impl.jdbcjobstore.MSSQLDelegate
#org.quartz.jobStore.driverDelegateClass = org.quartz.impl.jdbcjobstore.oracle.OracleDelegate
org.quartz.jobStore.useProperties = false
org.quartz.jobStore.dataSource = myDS
org.quartz.jobStore.tablePrefix = QRTZ_
org.quartz.jobStore.isClustered = false
这些配置,他会把JOB保存到数据库中, 所以要序列化 ,注释掉就OK了
谢谢楼上,这是半年之前的问题了,其实当时我就是要把job保存在数据库中 因为如果不这样,一旦服务器宕机,我的JOB就销声匿迹了. 22 楼 huangpengxiao 2007-06-23 其实这个问题就是如何让MehiodInvokingJobDetailFactoryBean这个类关联的那个Job持久化.
如果你给这个类配置了DataSource 你会发现 这个是个错误的选择