quarkusio/quarkus · error · IllegalStateException

SchedulerException while getting trigger (no message)

Error message

SchedulerException while getting trigger (no message)

What it means

While reconciling an annotated @Scheduled job, the wrapper fetches the current Quartz trigger; any SchedulerException raised by the underlying scheduler (JDBC store down, corrupted trigger, schema issues) is wrapped in an IllegalStateException with no custom message, so the original SchedulerException is the cause to inspect.

Source

Thrown at extensions/quartz/runtime/src/main/java/io/quarkus/quartz/runtime/QuartzSchedulerImpl.java:1042

            // Job is disabled
            return null;
        }

        JobInstrumenter instrumenter = null;
        if (schedulerConfig.tracingEnabled() && jobInstrumenter.isResolvable()) {
            instrumenter = jobInstrumenter.get();
        }
        invoker = initInvoker(invoker, events, scheduled.concurrentExecution(), skipPredicate, instrumenter,
                vertx, task != null && runtimeConfig.runBlockingScheduledMethodOnQuartzThread(),
                SchedulerUtils.parseExecutionMaxDelayAsMillis(scheduled), blockingExecutor);
        QuartzTrigger quartzTrigger = new QuartzTrigger(trigger.getKey(),
                new Function<>() {
                    @Override
                    public org.quartz.Trigger apply(TriggerKey triggerKey) {
                        try {
                            return scheduler.getTrigger(triggerKey);
                        } catch (SchedulerException e) {
                            throw new IllegalStateException(e);
                        }
                    }
                }, invoker,
                SchedulerUtils.parseOverdueGracePeriod(scheduled, defaultOverdueGracePeriod),
                runtimeConfig.runBlockingScheduledMethodOnQuartzThread(), true, null, description);
        QuartzTrigger existing = scheduledTasks.putIfAbsent(scheduled.identity(), quartzTrigger);

        if (existing != null) {
            throw new IllegalStateException("A job with this identity is already scheduled: " + scheduled.identity());
        }

        try {
            if (oldTrigger != null) {
                scheduler.rescheduleJob(trigger.getKey(), trigger);
                LOGGER.debugf("Rescheduled job definition with config %s", scheduled);
            } else {
                scheduler.scheduleJob(jobDetail, trigger);
                LOGGER.debugf("Scheduled job definition with config %s", scheduled);

View on GitHub (pinned to e1c734241f)

Solutions

  1. Inspect the caused-by SchedulerException for the real root cause
  2. Verify the Quartz JDBC store tables exist and match the Quartz version (run the Quartz DDL scripts)
  3. Test the datasource connectivity and pool health used by `quarkus.quartz.store-type=db`
  4. Fall back to `store-type=memory` to isolate whether the DB store is the problem

Example fix

null
Defensive patterns

Strategy: try-catch

Validate before calling

// verify store health before scheduling
try (Connection c = dataSource.getConnection()) { /* DB reachable */ }

Try / catch

try { scheduler.newJob(id).schedule(); } catch (IllegalStateException e) {
    Throwable root = e; while (root.getCause() != null) root = root.getCause();
    if (root instanceof SchedulerException) { /* handle store outage */ }
}

Prevention

When it happens

Trigger: Scheduler lookup of a TriggerKey during programmatic scheduling of a @Scheduled-defined job fails: DB store unreachable, table missing/locked, Quartz tables schema mismatch, or scheduler not started.

Common situations: Quartz JDBC tables not initialized (missing quartz tables DDL); DB connection pool exhausted; upgrading Quarkus/Quartz with an incompatible QRTZ_ schema; network outage to the configured datasource.

Related errors


AI-assisted analysis of quarkusio/quarkus@e1c734241f (2026-09-05). Data as JSON: /api/errors/19d203c61c8a51ca. Report an issue: GitHub.