2023-12-18 19:44:40.740 [main] ERROR org.springframework.boot.SpringApplication - Application run failed
java.lang.IllegalStateException: Failed to execute CommandLineRunner
at org.springframework.boot.SpringApplication.callRunner(SpringApplication.java:784)
at org.springframework.boot.SpringApplication.callRunners(SpringApplication.java:765)
at org.springframework.boot.SpringApplication.run(SpringApplication.java:319)
at org.springframework.boot.SpringApplication.run(SpringApplication.java:1215)
at org.springframework.boot.SpringApplication.run(SpringApplication.java:1204)
at com.yihu.AdminApplication.main(AdminApplication.java:24)
Caused by: com.yihu.common.exception.RenException: org.quartz.ObjectAlreadyExistsException: Unable to store Job : 'DEFAULT.TASK_1539889387878555650', because one already exists with this identification.
at com.yihu.modules.job.utils.ScheduleUtils.createScheduleJob(ScheduleUtils.java:70)
at com.yihu.modules.job.init.JobCommandLineRunner.run(JobCommandLineRunner.java:58)
at org.springframework.boot.SpringApplication.callRunner(SpringApplication.java:781)
... 5 common frames omitted
Caused by: org.quartz.ObjectAlreadyExistsException: Unable to store Job : 'DEFAULT.TASK_1539889387878555650', because one already exists with this identification.
at org.quartz.impl.jdbcjobstore.JobStoreSupport.storeJob(JobStoreSupport.java:1113)
at org.quartz.impl.jdbcjobstore.JobStoreSupport$2.executeVoid(JobStoreSupport.java:1067)
at org.quartz.impl.jdbcjobstore.JobStoreSupport$VoidTransactionCallback.execute(JobStoreSupport.java:3765)
at org.quartz.impl.jdbcjobstore.JobStoreSupport$VoidTransactionCallback.execute(JobStoreSupport.java:3763)
at org.quartz.impl.jdbcjobstore.JobStoreCMT.executeInLock(JobStoreCMT.java:245)
at org.quartz.impl.jdbcjobstore.JobStoreSupport.storeJobAndTrigger(JobStoreSupport.java:1063)
at org.quartz.core.QuartzScheduler.scheduleJob(QuartzScheduler.java:855)
at org.quartz.impl.StdScheduler.scheduleJob(StdScheduler.java:249)
at com.yihu.modules.job.utils.ScheduleUtils.createScheduleJob(ScheduleUtils.java:64)
... 7 common frames omitted
qrtz_cron_triggers 、qrtz_triggers、 qrtz_job_details三张表数据是对应的,qrtz_cron_triggers存在对qrtz_triggers的外键引用,qrtz_job_details存在对qrtz_cron_triggers外键引用,正常情况下数据应该是一一对应,上述报错是因为qrtz_job_details中存在脏数据,执行以下sql,删除查询查询出来的内容
SELECT * FROM `qrtz_triggers` where JOB_NAME NOT in (SELECT JOB_NAME FROM `qrtz_cron_triggers`);
SELECT * FROM `qrtz_job_details` where JOB_NAME NOT in (SELECT JOB_NAME FROM `qrtz_triggers`);