quarkusio/quarkus · error · ConfigurationException

Quartz datasource resolution can be either deferred to runti

Error message

Quartz datasource resolution can be either deferred to runtime or specified at build time but not both. Related properties are quarkus.quartz.defer-datasource-check=%s and quarkus.quartz.datasource=%s

What it means

The Quartz build-time configuration is contradictory: quarkus.quartz.defer-datasource-check=true (datasource resolved at runtime) is combined with an explicit quarkus.quartz.datasource name (build-time resolution). The driver() build step can only follow one resolution strategy, so it rejects the combination at build time.

Source

Thrown at extensions/quartz/deployment/src/main/java/io/quarkus/quartz/deployment/QuartzProcessor.java:179

                    }
                }
                if (!implementsKnownDelegate) {
                    String message = String.format(
                            "Custom JDBC delegate implementation with name '%s' needs to be a subclass of one of the existing Quarkus delegates such as io.quarkus.quartz.runtime.jdbc.QuarkusPostgreSQLDelegate.",
                            driverDelegate.get());
                    throw new ConfigurationException(message);
                }
            }
            // A custom delegate implementation, we don't need to check datasources
            return new QuartzJDBCDriverDialectBuildItem(driverDelegate, null);
        } else {
            if (config.deferDatasourceCheck()) {
                // if defer is set to true and there is a DS name, throw an exception
                if (config.dataSourceName().isPresent()) {
                    String message = String.format(
                            "Quartz datasource resolution can be either deferred to runtime or specified at build time but not both. Related properties are quarkus.quartz.defer-datasource-check=%s and quarkus.quartz.datasource=%s",
                            config.deferDatasourceCheck(), config.dataSourceName());
                    throw new ConfigurationException(message);
                }
                // Defer driver resolution to runtime
                List<JDBCDataSource> dataSources = new ArrayList<>();
                for (JdbcDataSourceBuildItem jdbcDataSourceBuildItem : jdbcDataSourceBuildItems) {
                    dataSources.add(new JDBCDataSource(jdbcDataSourceBuildItem.getName(), jdbcDataSourceBuildItem.isDefault(),
                            jdbcDataSourceBuildItem.getDbKind()));
                }
                return new QuartzJDBCDriverDialectBuildItem(Optional.empty(), dataSources);
            } else {
                // Perform driver resolution at build time
                Optional<JdbcDataSourceBuildItem> selectedJdbcDataSourceBuildItem = jdbcDataSourceBuildItems.stream()
                        .filter(i -> config.dataSourceName().isPresent() ? config.dataSourceName().get().equals(i.getName())
                                : i.isDefault())
                        .findFirst();

                if (!selectedJdbcDataSourceBuildItem.isPresent()) {
                    String message = String.format(
                            "JDBC Store configured but the '%s' datasource is not configured properly. You can configure your datasource by following the guide available at: https://quarkus.io/guides/datasource",

View on GitHub (pinned to e1c734241f)

Solutions

  1. Remove quarkus.quartz.datasource=<name> if you want runtime datasource resolution (keep defer-datasource-check=true).
  2. Or set quarkus.quartz.defer-datasource-check=false (or remove it) for build-time resolution against the named datasource.
  3. Check profile-specific config files and environment variables so only one of the two properties is active.

Example fix

// before
quarkus.quartz.defer-datasource-check=true
quarkus.quartz.datasource=myds

// after (choose one)
quarkus.quartz.defer-datasource-check=true
// or
quarkus.quartz.datasource=myds
Defensive patterns

Strategy: validation

Validate before calling

java.util.Properties p = new java.util.Properties();
p.load(new java.io.FileInputStream("application.properties"));
boolean defer = Boolean.parseBoolean(p.getProperty("quarkus.quartz.defer-datasource-check", "false"));
String ds = p.getProperty("quarkus.quartz.datasource");
if (defer && ds != null) {
    throw new IllegalStateException("Use either quarkus.quartz.defer-datasource-check=true OR quarkus.quartz.datasource, not both");
}

Prevention

When it happens

Trigger: application.properties contains both quarkus.quartz.defer-datasource-check=true and quarkus.quartz.datasource=<name> while store-type is a JDBC store; or defer is set via profile/env variable while a datasource name is hardcoded in build-time properties.

Common situations: Enabling defer-datasource-check to support runtime datasources without removing an older quarkus.quartz.datasource entry; copying config snippets from different guides; profiles where one profile sets defer=true and the base config sets a datasource name.

Related errors


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