quarkusio/quarkus · error · IllegalStateException

JDBC Store configured but '%s' datasource is missing. You ca

Error message

JDBC Store configured but '%s' datasource is missing. You can configure your datasource by following the guide available at: https://quarkus.io/guides/datasource

What it means

QuarkusQuartzConnectionPoolProvider resolves the DataSource backing the Quartz JDBC job store at startup. When the configured (or default) datasource is not present/available, it throws IllegalStateException with this message pointing to the datasource guide. This happens in the constructor before any Quartz scheduling starts.

Source

Thrown at extensions/quartz/runtime/src/main/java/io/quarkus/quartz/runtime/QuarkusQuartzConnectionPoolProvider.java:35

    private AgroalDataSource dataSource;
    private static String dataSourceName;

    public QuarkusQuartzConnectionPoolProvider() {
        final ArcContainer container = Arc.container();
        final InstanceHandle<AgroalDataSource> instanceHandle;
        final boolean useDefaultDataSource = "QUARKUS_QUARTZ_DEFAULT_DATASOURCE".equals(dataSourceName);
        if (useDefaultDataSource) {
            instanceHandle = container.instance(AgroalDataSource.class);
        } else {
            instanceHandle = container.instance(AgroalDataSource.class, new DataSourceLiteral(dataSourceName));
        }
        if (instanceHandle.isAvailable()) {
            this.dataSource = instanceHandle.get();
        } else {
            String message = String.format(
                    "JDBC Store configured but '%s' datasource is missing. You can configure your datasource by following the guide available at: https://quarkus.io/guides/datasource",
                    useDefaultDataSource ? "default" : dataSourceName);
            throw new IllegalStateException(message);
        }
    }

    @Override
    public DataSource getDataSource() {
        return dataSource;
    }

    @Override
    public Connection getConnection() throws SQLException {
        return dataSource.getConnection();
    }

    @Override
    public void shutdown() {
        // Do nothing as the connection will be closed inside the Agroal extension
    }

View on GitHub (pinned to e1c734241f)

Solutions

  1. Configure the default datasource (quarkus.datasource.db-kind, username, password, jdbc.url) or the named one referenced by quarkus.quartz.datasource.
  2. Add quarkus-agroal and the matching JDBC driver extension to the project.
  3. Check the quarkus.quartz.datasource value matches an existing named datasource configuration.
  4. Verify the datasource is available in the active profile (dev/test/prod config).

Example fix

# before (no datasource)
quarkus.quartz.store-type=jdbc-store

# after
quarkus.quartz.store-type=jdbc-store
quarkus.datasource.db-kind=postgresql
quarkus.datasource.username=quartz
quarkus.datasource.password=secret
quarkus.datasource.jdbc.url=jdbc:postgresql://localhost:5432/quartz
Defensive patterns

Strategy: validation

Validate before calling

// before enabling jdbc-store, confirm the datasource config exists
// (e.g. in a startup check or test)
String dsName = "default"; // or value of quarkus.quartz.datasource
if (ConfigProvider.getConfig().getOptionalValue("quarkus.datasource." + (dsName.equals("default") ? "" : dsName + ".") + "jdbc.url", String.class).isEmpty()) {
    throw new IllegalStateException("Quartz jdbc-store requires datasource '" + dsName + "' to be configured");
}

Try / catch

try {
    scheduler = quartzSchedulerProducer.get();
} catch (IllegalStateException e) {
    if (e.getMessage().contains("datasource is missing")) {
        log.error("Configure the Quartz JDBC datasource per https://quarkus.io/guides/datasource");
    }
    throw e;
}

Prevention

When it happens

Trigger: quarkus.quartz.store-type=jdbc-store is set but no Agroal datasource instance named by quarkus.quartz.datasource (or the default datasource) is registered/available in the container.

Common situations: Using jdbc-store without adding the Agroal extension or datasource config; misspelled quarkus.quartz.datasource name; named datasource defined only in a non-active profile; datasource bean failed to initialize earlier.

Related errors


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