quarkusio/quarkus · error · UnsupportedOperationException

Value found for #getNonJtaDataSource : not supported

Error message

Value found for #getNonJtaDataSource : not supported

What it means

Same verification path as the JTA case: verifyIgnoredFields rejects non-JTA data sources too. Quarkus does not consume a DataSource from the persistence unit descriptor; all database wiring goes through Quarkus configuration. A non-null getNonJtaDataSource() throws this UnsupportedOperationException (note: message says 'not supported' without 'yet').

Source

Thrown at extensions/hibernate-orm/runtime/src/main/java/io/quarkus/hibernate/orm/runtime/boot/QuarkusPersistenceUnitDescriptor.java:223

    private static void verifyIgnoredFields(final PersistenceUnitDescriptor toClone) {
        // This one needs to be ignored:
        // if ( toClone.getPersistenceUnitRootUrl() != null ) {
        // throw new UnsupportedOperationException( "Value found for
        // #getPersistenceUnitRootUrl : not supported yet" );
        // }

        // getMappingFiles() is ignored and replaced with an empty list,
        // because we don't need Hibernate ORM to parse the mappings files:
        // they are parsed at compile time and side-loaded during static init.

        if (toClone.getJarFileUrls() != null && !toClone.getJarFileUrls().isEmpty()) {
            throw new UnsupportedOperationException("Value found for #getJarFileUrls : not supported yet");
        }
        if (toClone.getJtaDataSource() != null) {
            throw new UnsupportedOperationException("Value found for #getJtaDataSource : not supported yet");
        }
        if (toClone.getNonJtaDataSource() != null) {
            throw new UnsupportedOperationException("Value found for #getNonJtaDataSource : not supported");
        }
    }

    @Override
    public String toString() {
        return "QuarkusPersistenceUnitDescriptor{" +
                "name='" + name + '\'' +
                ", providerClassName='" + providerClassName + '\'' +
                ", useQuotedIdentifiers=" + useQuotedIdentifiers +
                ", transactionType=" + persistenceUnitTransactionType +
                ", validationMode=" + validationMode +
                ", sharedCacheMode=" + sharedCacheMode +
                ", managedClassNames=" + managedClassNames +
                ", properties=" + properties +
                ", isReactive=" + reactive +
                '}';
    }

View on GitHub (pinned to e1c734241f)

Solutions

  1. Ensure getNonJtaDataSource() is null; configure the database via quarkus.datasource.* properties instead.
  2. Delete setNonJtaDataSource calls from custom descriptor construction code.
  3. Bind the persistence unit to a named Quarkus data source using quarkus.hibernate.orm.datasource if multiple data sources exist.

Example fix

// before
descriptor.setNonJtaDataSource(ds);
// after
descriptor.setNonJtaDataSource(null); // let Quarkus wire the datasource via config
Defensive patterns

Strategy: validation

Validate before calling

if (desc.getNonJtaDataSource() != null) {
    throw new IllegalStateException("Set quarkus.datasource.* config instead of non-JTA datasource on the descriptor");
}

Try / catch

try {
    quarkusBoot();
} catch (UnsupportedOperationException e) {
    if (e.getMessage().contains("getNonJtaDataSource")) {
        log.error("Remove setNonJtaDataSource; let Quarkus wire the datasource");
    }
}

Prevention

When it happens

Trigger: A PersistenceUnitDescriptor/PersistenceUnitInfo passed into Quarkus boot has setNonJtaDataSource(...) called, e.g. from programmatic bootstrap code mimicking Java SE Hibernate setup.

Common situations: Reusing descriptors from Spring Boot/Java SE Hibernate setups where non-JTA DataSource is standard; helper libraries that populate nonJtaDataSource automatically; tests constructing PersistenceUnitInfo manually with a DataSource.

Related errors


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