【发布时间】:2020-11-28 10:07:46
【问题描述】:
下面是代码,
Trigger trigger = TriggerBuilder
.newTrigger().withIdentity(job.getTriggerName(), job.getGroupName())
.withSchedule(CronScheduleBuilder.cronSchedule(new CronExpression(cronExpression)).inTimeZone(TimeZone.getTimeZone(remoteTimezone)).withMisfireHandlingInstructionFireAndProceed())
.startAt(startDate)
.endAt(endDate)
.build();
以下是日志,
[11-28 15:30:00,906] [pool-1-thread-1] [INFO:QuartzJob:99] job.getStartTimes() - 10:00,11:00,12:00
[11-28 15:30:00,908] [pool-1-thread-1] [INFO:QuartzJob:105] dateValue - Sat Nov 28 15:30:00 IST 2020
[11-28 15:30:00,909] [pool-1-thread-1] [INFO:QuartzJob:105] dateValue - Sat Nov 28 16:30:00 IST 2020
[11-28 15:30:00,910] [pool-1-thread-1] [INFO:QuartzJob:105] dateValue - Sat Nov 28 17:30:00 IST 2020
[11-28 15:30:00,913] [pool-1-thread-1] [INFO:QuartzJob:130] mins --- 30
[11-28 15:30:00,913] [pool-1-thread-1] [INFO:QuartzJob:131] hours --- 15,16,17
[11-28 15:30:00,913] [pool-1-thread-1] [INFO:QuartzJob:132] Timezone startDate --- Sat Nov 28 15:30:00 IST 2020
[11-28 15:30:00,913] [pool-1-thread-1] [INFO:QuartzJob:133] Timezone endDate --- Sat Nov 28 17:30:00 IST 2020
[11-28 15:30:00,913] [pool-1-thread-1] [INFO:QuartzJob:137] Generated cronExpression for the Job is - 0 30 15,16,17 * * ?
作业开始时间值采用 GMT 格式,转换为 IST 并生成 Cron 表达式。 但是出现以下错误,
[11-28 15:30:00,936] [pool-1-thread-1] [ERROR:JobExecutor:71] org.quartz.SchedulerException: Based on configured schedule, the given trigger '2020-11-28-DUMMY_JOB_TEST-Jobs.2020-11-28-DUMMY_JOB_TEST-Trigger' will never fire.
不明白为什么会这样? 与 .startNow() 也得到相同的错误。
任何帮助将不胜感激。
【问题讨论】:
-
这真的很奇怪。你能分享你的应用程序或它的简化版本吗?我可以尝试使用我的本地 QuartzDesk 安装来分析发生了什么,并在此处分享结果。
标签: java quartz-scheduler scheduling