Quartz error A step longer than the field
Increment >= 60 : 90
java.lang.RuntimeException: CronExpression '0 0/90 * * * ?' is invalid.
Caused by: java.text.ParseException: Increment >= 60 : 90java.lang.RuntimeException: CronExpression '0 0 0/24 * * ?' is invalid.
Caused by: java.text.ParseException: Increment >= 24 : 24Message produced by running the expression through org.quartz.CronExpression from Quartz 2.5.2.
What it means
A step like 0/90 means “start at 0, then every 90”, but it only counts within one field. The minute field stops at 59, so Quartz rejects any minute or second step of 60 or more, and any hour step of 24 or more. The number after the colon is the step you wrote.
An interval that doesn’t fit inside an hour, or a day, can’t be written as one step. When it divides the day evenly, two expressions on the same job can cover it.
Rejected expressions and their fixes
Each expression opens in the tester. The message under a rejected one is what Quartz 2.5.2 printed for it.
-
Use0 0 * * * ?Every hour, on the hour.
Every 60 minutes is every hour on the hour.
-
Every 90 minutes from midnight: on the hour every third hour from 00:00, and at half past every third hour from 01:00. Give the job both triggers. More on this schedule.
-
Use0 0 0 * * ?At 00:00.
Every 24 hours is once a day.
Questions
- How do I run every 90 minutes in Quartz?
- With two cron triggers on one job:
0 0 0/3 * * ?and0 30 1/3 * * ?. Together they fire at 00:00, 01:30, 03:00 and so on. ASimpleTriggerwith a 90-minute interval also works, but it counts from its start time rather than the clock. - Is
0/30the same as*/30in Quartz? - Yes. Both mean 0 and 30, because the step starts at the bottom of the field and stops at its top.
Other Quartz errors
- Support for specifying both a day-of-week AND a day-of-month parameter is not implemented.Quartz: Both day fields are set
- Unexpected end of expression.Quartz: Five fields instead of six
- '?' can only be specified for Day-of-Month -OR- Day-of-Week.Quartz:
?in the wrong place - Day-of-Week values must be between 1 and 7Quartz: Sunday written as 0
- Hour values must be between 0 and 23Quartz: A value out of range
- Unexpected character: @Quartz:
@dailyand other shortcuts