Issue with Quartz Scheduler - Job triggering instantly instead of following provided Cron expression

I’m writing to address an issue we’re facing with the Quartz Scheduler. Currently, we’re observing that jobs are triggering instantly instead of following the provided Cron expression.
As I am scheduling the job through the database, whenever the data is saved in the database, it gets triggered automatically first, and then the second fire occurs according to the provided Cron expression.

For your reference I am sharing the details and scenario regarding this :

I am setting the following values in DB:
qrtzTrigger.setStartTime(currentTimeMillis);
qrtzTrigger.setNextFireTime(-1); or value :0
qrtzTrigger.setPrevFireTime( -1); or value :0
qrtzTrigger.setPriority(5);
qrtzTrigger.setEndTime(0L);
qrtzTrigger.setMisfireInstr(0);

However, this configuration doesn’t seem to prevent instant triggering.

And the scenario is like :

  • Cron Expression: 0 37 0 2,3 * ? *
  • Next/Prev Fire Date: 0
  • State: Waiting

**Data saved in database at : 2024-05-02 00:33:31.748
**Job Execution Time : 2024-05-02 00:33:49.579

After the first job execution:

  • Next Fire Date: 02/05/2024 00:37:00
  • Prev Fire Date: 02/05/2024 00:33:48

After the second job execution:
**Job Execution Time : 2024-05-02 00:37:00.221

  • Next Fire Date: 03/05/2024 00:37:00
  • Last Fire Date: 02/05/2024 00:37:00

Could you please help us understand why this is happening and suggest a solution?
Response for this as soon as possible will be highly appreciated.
Thanks.

In addition, when the instant job executes, we receive the following log message:
“Handling 1 trigger(s) that missed their scheduled fire-time.”

Must be 6 items in cron expression (Sec, Min, Hour, Day, Month, Week):
image

You have - 7

I have modified the Cron Expression , now it’s : 0 27 13 2,3 * ? (like you mentioned of 6 items only)

Still, when I am saving details in database for qrtz_triggers, then it is instantly triggering my job.

Cron : 0 27 13 2,3 * ?
Data saving time in DB : 2024-05-02 13:23:51.990
Jo execution time : 2024-05-02 13:24:16.188

Logs:
2024-05-02 13:24:15.526 INFO 17584 — [_MisfireHandler] o.s.s.quartz.LocalDataSourceJobStore : Handling 1 trigger(s) that missed their scheduled fire-time.
2024-05-02 13:24:16.188 INFO 17584 — [eduler_Worker-3] com.company.api_test.jobs.BatchJob : Execution Job Started…

Resolved.