quarkusio/quarkus · critical · IllegalStateException

Unable to create Scheduler

Error message

Unable to create Scheduler

What it means

QuartzSchedulerImpl creates the org.quartz.Scheduler during construction; any SchedulerException (or other failure) from the StdSchedulerFactory/transaction path is wrapped in IllegalStateException('Unable to create Scheduler'). The original cause is chained, and on transactional stores a rollback is attempted and logged first.

Source

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

                                throw new IllegalStateException("Unable to obtain the trigger for " + triggerKey);
                            }
                            createJobDefinitionQuartzTrigger(new SerializedExecutionMetadata(jobDetail), scheduled, oldTrigger);
                        }
                    }
                }

                if (transaction != null) {
                    transaction.commit();
                }
            } catch (Throwable e) {
                if (transaction != null) {
                    try {
                        transaction.rollback();
                    } catch (SystemException ex) {
                        LOGGER.error("Unable to rollback transaction", ex);
                    }
                }
                throw new IllegalStateException("Unable to create Scheduler", e);
            }
        }
    }

    @Produces
    @Singleton
    org.quartz.Scheduler produceQuartzScheduler() {
        if (scheduler == null) {
            throw new IllegalStateException(
                    "Quartz scheduler is either explicitly disabled through quarkus.scheduler.enabled=false or no @Scheduled methods were found. If you only need to schedule a job programmatically you can force the start of the scheduler by setting 'quarkus.scheduler.start-mode=forced'.");
        }
        return scheduler;
    }

    @Override
    public org.quartz.Scheduler getScheduler() {
        return scheduler;
    }

View on GitHub (pinned to e1c734241f)

Solutions

  1. Read the chained cause in the stack trace to identify the underlying SchedulerException.
  2. For jdbc-store, run the Quartz schema DDL for your DB version and verify connectivity/credentials.
  3. Check Quartz driver delegate class matches your DB (quarkus.quartz.driver-delegate or auto-detection).
  4. Review quarkus.quartz.* properties (instance-id, cluster-checkin-interval, store-type) for invalid combinations.

Example fix

# before: jdbc-store without tables
quarkus.quartz.store-type=jdbc-store

# after: tables created first (example for Postgres)
# psql -f postgres-script/tables_postgres.sql
quarkus.quartz.store-type=jdbc-store
quarkus.quartz.clustered=true
Defensive patterns

Strategy: try-catch

Validate before calling

// pre-flight: with jdbc-store, verify DB reachability and table existence before startup
try (var c = java.sql.DriverManager.getConnection(url, user, pass);
     var rs = c.getMetaData().getTables(null, null, "QRTZ_TRIGGERS", null)) {
    if (!rs.next()) throw new IllegalStateException("Quartz tables missing — run the schema DDL");
} catch (java.sql.SQLException e) {
    throw new IllegalStateException("Quartz DB unreachable: " + e.getMessage(), e);
}

Try / catch

try {
    scheduler = container.instance(org.quartz.Scheduler.class).get();
} catch (IllegalStateException e) {
    if ("Unable to create Scheduler".equals(e.getMessage())) {
        // inspect e.getCause() (SchedulerException) for the root: DB, delegate, properties
        log.error("Scheduler init failed", e.getCause());
    }
    throw e;
}

Prevention

When it happens

Trigger: StdSchedulerFactory fails to build the scheduler — bad Quartz properties (e.g. invalid instance id, delegate class missing), JDBC store misconfiguration, DB unreachable, table schema mismatch, classloading failure of configured store/driver classes.

Common situations: JDBC store with wrong DB credentials/URL; Quartz tables missing (never ran the DDL) or from an incompatible Quartz version; duplicate scheduler names with clustered mode misconfig; driver class not on classpath.

Related errors


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