quarkusio/quarkus · error · UnsupportedOperationException

Value found for #getJtaDataSource : not supported yet

Error message

Value found for #getJtaDataSource : not supported yet

What it means

During validateAndReadFrom, QuarkusPersistenceUnitDescriptor.verifyIgnoredFields rejects descriptors that reference a JTA data source, because Quarkus wires data sources itself via quarkus.datasource and Agroal rather than accepting JNDI/JTA sources from persistence.xml. A non-null getJtaDataSource() triggers this UnsupportedOperationException.

Source

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

        // has never been supported
    }

    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. Leave getJtaDataSource() null and configure the data source with quarkus.datasource.* properties; Quarkus injects it into the persistence unit.
  2. Remove code that calls setJtaDataSource on the descriptor before handing it to Quarkus.
  3. Use quarkus.hibernate.orm.datasource (if needed) to bind the PU to a named Quarkus data source.

Example fix

// before
PersistenceUnitDescriptor d = ...;
d.setJtaDataSource(dataSource); // unsupported in Quarkus
// after
// application.properties:
// quarkus.datasource.db-kind=postgresql
// quarkus.datasource.username=...
// quarkus.hibernate.orm.datasource=myds
PersistenceUnitDescriptor d = ...; // no JTA datasource set
Defensive patterns

Strategy: validation

Validate before calling

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

Try / catch

try {
    quarkusBoot();
} catch (UnsupportedOperationException e) {
    if (e.getMessage().contains("getJtaDataSource")) {
        log.error("Remove setJtaDataSource; configure quarkus.datasource instead");
    }
}

Prevention

When it happens

Trigger: A persistence unit descriptor (often produced by external tooling or a custom PersistenceUnitInfo) has setJtaDataSource(...) set when Quarkus clones and validates it at boot.

Common situations: Programmatic EntityManagerFactory creation reusing descriptors from a non-Quarkus environment; copy-pasted Java SE/Jakarta bootstrap code that calls setJtaDataSource; integrating a library that supplies its own PersistenceUnitInfo with a DataSource.

Related errors


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