概述
测试服应用 启动, quartz模块 报错
Handling 2 trigger(s) that missed their scheduled fire-time
MisfireHandler: Error handling misfires: Couldn’t store trigger ‘group2.job2’ for ‘group2.job2’ job:Couldn’t retrieve job because a required class was not found: com.example.quartz_demo.job.ScheduledJob
org.quartz.JobPersistenceException: Couldn’t store trigger ‘group2.job2’ for ‘group2.job2’ job:Couldn’t retrieve job because a required class was not found: com.example.quartz_demo.job.ScheduledJob
Caused by: org.quartz.JobPersistenceException: Couldn’t retrieve job because a required class was not found: com.example.quartz_demo.job.ScheduledJob
Caused by: java.lang.ClassNotFoundException: com.example.quartz_demo.job.ScheduledJob
具体如下:
2019-11-15 14:12:22.721 INFO 6 --- [lerFactoryBean]] o.s.s.quartz.SchedulerFactoryBean : Starting Quartz Scheduler now, after delay of 1 seconds
2019-11-15 14:12:22.756 INFO 6 --- [lerFactoryBean]] o.s.s.quartz.LocalDataSourceJobStore : ClusterManager: detected 1 failed or restarted instances.
2019-11-15 14:12:22.756 INFO 6 --- [lerFactoryBean]] o.s.s.quartz.LocalDataSourceJobStore : ClusterManager: Scanning for instance "BizMsTestAlpha1573796467977"'s failed in-progress jobs.
2019-11-15 14:12:22.778 INFO 6 --- [lerFactoryBean]] org.quartz.core.QuartzScheduler : Scheduler schedulerFactoryBean_$_BizMsTestAlpha1573798335259 started.
2019-11-15 14:12:22.810 INFO 6 --- [_MisfireHandler] o.s.s.quartz.LocalDataSourceJobStore : Handling 2 trigger(s) that missed their scheduled fire-time.
2019-11-15 14:12:22.865 ERROR 6 --- [_MisfireHandler] o.s.s.quartz.LocalDataSourceJobStore : MisfireHandler: Error handling misfires: Couldn't store trigger 'group2.job2' for 'group2.job2' job:Couldn't retrieve job because a required class was not found: com.example.quartz_demo.job.ScheduledJob
org.quartz.JobPersistenceException: Couldn't store trigger 'group2.job2' for 'group2.job2' job:Couldn't retrieve job because a required class was not found: com.example.quartz_demo.job.ScheduledJob
at org.quartz.impl.jdbcjobstore.JobStoreSupport.storeTrigger(JobStoreSupport.java:1223) ~[quartz-2.2.3.jar!/:na]
at org.quartz.impl.jdbcjobstore.JobStoreSupport.doUpdateOfMisfiredTrigger(JobStoreSupport.java:1037) ~[quartz-2.2.3.jar!/:na]
at org.quartz.impl.jdbcjobstore.JobStoreSupport.recoverMisfiredJobs(JobStoreSupport.java:986) ~[quartz-2.2.3.jar!/:na]
at org.quartz.impl.jdbcjobstore.JobStoreSupport.doRecoverMisfires(JobStoreSupport.java:3203) ~[quartz-2.2.3.jar!/:na]
at org.quartz.impl.jdbcjobstore.JobStoreSupport$MisfireHandler.manage(JobStoreSupport.java:3951) [quartz-2.2.3.jar!/:na]
at org.quartz.impl.jdbcjobstore.JobStoreSupport$MisfireHandler.run(JobStoreSupport.java:3972) [quartz-2.2.3.jar!/:na]
Caused by: org.quartz.JobPersistenceException: Couldn't retrieve job because a required class was not found: com.example.quartz_demo.job.ScheduledJob
at org.quartz.impl.jdbcjobstore.JobStoreSupport.retrieveJob(JobStoreSupport.java:1388) ~[quartz-2.2.3.jar!/:na]
at org.quartz.impl.jdbcjobstore.JobStoreSupport.storeTrigger(JobStoreSupport.java:1205) ~[quartz-2.2.3.jar!/:na]
... 5 common frames omitted
Caused by: java.lang.ClassNotFoundException: com.example.quartz_demo.job.ScheduledJob
at java.net.URLClassLoader.findClass(URLClassLoader.java:382) ~[na:1.8.0_222]
at java.lang.ClassLoader.loadClass(ClassLoader.java:424) ~[na:1.8.0_222]
at org.springframework.boot.loader.LaunchedURLClassLoader.loadClass(LaunchedURLClassLoader.java:94) ~[core-0.0.1.jar:0.0.1]
at java.lang.ClassLoader.loadClass(ClassLoader.java:357) ~[na:1.8.0_222]
at org.springframework.util.ClassUtils.forName(ClassUtils.java:274) ~[spring-core-5.0.8.RELEASE.jar!/:5.0.8.RELEASE]
at org.springframework.scheduling.quartz.ResourceLoaderClassLoadHelper.loadClass(ResourceLoaderClassLoadHelper.java:81) ~[spring-context-support-5.0.8.RELEASE.jar!/:5.0.8.RELEASE]
at org.springframework.scheduling.quartz.ResourceLoaderClassLoadHelper.loadClass(ResourceLoaderClassLoadHelper.java:86) ~[spring-context-support-5.0.8.RELEASE.jar!/:5.0.8.RELEASE]
at org.quartz.impl.jdbcjobstore.StdJDBCDelegate.selectJobDetail(StdJDBCDelegate.java:852) ~[quartz-2.2.3.jar!/:na]
at org.quartz.impl.jdbcjobstore.JobStoreSupport.retrieveJob(JobStoreSupport.java:1385) ~[quartz-2.2.3.jar!/:na]
... 6 common frames omitted
2019-11-15 14:13:12.804 INFO 6 --- [_MisfireHandler] o.s.s.quartz.LocalDataSourceJobStore : Handling 2 trigger(s) that missed their scheduled fire-time.
2019-11-15 14:14:02.852 INFO 6 --- [_MisfireHandler] o.s.s.quartz.LocalDataSourceJobStore : Handling 2 trigger(s) that missed their scheduled fire-time.
2019-11-15 14:14:52.802 INFO 6 --- [_MisfireHandler] o.s.s.quartz.LocalDataSourceJobStore : Handling 2 trigger(s) that missed their scheduled fire-time.
2019-11-15 14:15:42.864 INFO 6 --- [_MisfireHandler] o.s.s.quartz.LocalDataSourceJobStore : Handling 2 trigger(s) that missed their scheduled fire-time.
2019-11-15 14:15:42.908 ERROR 6 --- [_MisfireHandler] o.s.s.quartz.LocalDataSourceJobStore : MisfireHandler: Error handling misfires: Couldn't store trigger 'group2.job2' for 'group2.job2' job:Couldn't retrieve job because a required class was not found: com.example.quartz_demo.job.ScheduledJob
org.quartz.JobPersistenceException: Couldn't store trigger 'group2.job2' for 'group2.job2' job:Couldn't retrieve job because a required class was not found: com.example.quartz_demo.job.ScheduledJob
at org.quartz.impl.jdbcjobstore.JobStoreSupport.storeTrigger(JobStoreSupport.java:1223) ~[quartz-2.2.3.jar!/:na]
at org.quartz.impl.jdbcjobstore.JobStoreSupport.doUpdateOfMisfiredTrigger(JobStoreSupport.java:1037) ~[quartz-2.2.3.jar!/:na]
at org.quartz.impl.jdbcjobstore.JobStoreSupport.recoverMisfiredJobs(JobStoreSupport.java:986) ~[quartz-2.2.3.jar!/:na]
at org.quartz.impl.jdbcjobstore.JobStoreSupport.doRecoverMisfires(JobStoreSupport.java:3203) ~[quartz-2.2.3.jar!/:na]
at org.quartz.impl.jdbcjobstore.JobStoreSupport$MisfireHandler.manage(JobStoreSupport.java:3951) [quartz-2.2.3.jar!/:na]
at org.quartz.impl.jdbcjobstore.JobStoreSupport$MisfireHandler.run(JobStoreSupport.java:3972) [quartz-2.2.3.jar!/:na]
Caused by: org.quartz.JobPersistenceException: Couldn't retrieve job because a required class was not found: com.example.quartz_demo.job.ScheduledJob
at org.quartz.impl.jdbcjobstore.JobStoreSupport.retrieveJob(JobStoreSupport.java:1388) ~[quartz-2.2.3.jar!/:na]
at org.quartz.impl.jdbcjobstore.JobStoreSupport.storeTrigger(JobStoreSupport.java:1205) ~[quartz-2.2.3.jar!/:na]
... 5 common frames omitted
Caused by: java.lang.ClassNotFoundException: com.example.quartz_demo.job.ScheduledJob
at java.net.URLClassLoader.findClass(URLClassLoader.java:382) ~[na:1.8.0_222]
at java.lang.ClassLoader.loadClass(ClassLoader.java:424) ~[na:1.8.0_222]
at org.springframework.boot.loader.LaunchedURLClassLoader.loadClass(LaunchedURLClassLoader.java:94) ~[core-0.0.1.jar:0.0.1]
at java.lang.ClassLoader.loadClass(ClassLoader.java:357) ~[na:1.8.0_222]
at org.springframework.util.ClassUtils.forName(ClassUtils.java:274) ~[spring-core-5.0.8.RELEASE.jar!/:5.0.8.RELEASE]
at org.springframework.scheduling.quartz.ResourceLoaderClassLoadHelper.loadClass(ResourceLoaderClassLoadHelper.java:81) ~[spring-context-support-5.0.8.RELEASE.jar!/:5.0.8.RELEASE]
at org.springframework.scheduling.quartz.ResourceLoaderClassLoadHelper.loadClass(ResourceLoaderClassLoadHelper.java:86) ~[spring-context-support-5.0.8.RELEASE.jar!/:5.0.8.RELEASE]
at org.quartz.impl.jdbcjobstore.StdJDBCDelegate.selectJobDetail(StdJDBCDelegate.java:852) ~[quartz-2.2.3.jar!/:na]
at org.quartz.impl.jdbcjobstore.JobStoreSupport.retrieveJob(JobStoreSupport.java:1385) ~[quartz-2.2.3.jar!/:na]
... 6 common frames omitted
2019-11-15 14:16:32.808 INFO 6 --- [_MisfireHandler] o.s.s.quartz.LocalDataSourceJobStore : Handling 2 trigger(s) that missed their scheduled fire-time.
分析:
上述报错说 触发不了group2.job2 找不到 任务 group2.job2 的执行类 com.example.quartz_demo.job.ScheduledJob,但是在测试服应用中根本就没有这个类,不存在包 com.example.quartz_demo,而且这个命名很像我写测试demo的工程命名风格。
而且,测试demo 和 现在启动的测试服应用 quartz模块 访问的数据库是同一个
所以呢,我怀疑是测试服应用启动时quartz模块从数据库加载任务时读取到了测试quartz的demo工程中创建的任务,去数据库中找到quartz表 QRTZ_TRIGGERS,可以看到有 group2.job2 ,在QRTZ_JOB_DETAILS表JOB_CLASS_NAME字段记录了任务执行类 com.example.quartz_demo.job.ScheduledJob
解决:
依次删除 QRTZ_CRON_TRIGGERS 、 QRTZ_JOB_DETAILS 、QRTZ_TRIGGERS 表中 group2.job2 记录信息(注: 如果不是按顺序删除,会报错 外键问题,根据提示找到外键关联表,删除其中记录即可)
重启项目,上述错误不再出现
注:如果还继续报错,但不是刚才删除的那个任务,而是新的任务,例如 group3.job3 , 那么继续按上面一样 删除掉数据库表中group3.job3记录信息,重启项目即可.
最后
以上就是耍酷小鸽子为你收集整理的Handling 2 trigger(s) that missed their scheduled fire-time,JobPersistenceException: Couldn't store的全部内容,希望文章能够帮你解决Handling 2 trigger(s) that missed their scheduled fire-time,JobPersistenceException: Couldn't store所遇到的程序开发问题。
如果觉得靠谱客网站的内容还不错,欢迎将靠谱客网站推荐给程序员好友。
发表评论 取消回复