{"record":{"id":"f16f882ab5c77ab9","repo":"quarkusio/quarkus","slug":"value-found-for-getjtadatasource-not-supported","errorCode":null,"errorMessage":"Value found for #getJtaDataSource : not supported yet","messagePattern":"Value found for #getJtaDataSource : not supported yet","errorType":"exception","errorClass":"UnsupportedOperationException","httpStatus":null,"severity":"error","filePath":"extensions/hibernate-orm/runtime/src/main/java/io/quarkus/hibernate/orm/runtime/boot/QuarkusPersistenceUnitDescriptor.java","lineNumber":220,"sourceCode":"        // has never been supported\n    }\n\n    private static void verifyIgnoredFields(final PersistenceUnitDescriptor toClone) {\n        // This one needs to be ignored:\n        // if ( toClone.getPersistenceUnitRootUrl() != null ) {\n        // throw new UnsupportedOperationException( \"Value found for\n        // #getPersistenceUnitRootUrl : not supported yet\" );\n        // }\n\n        // getMappingFiles() is ignored and replaced with an empty list,\n        // because we don't need Hibernate ORM to parse the mappings files:\n        // they are parsed at compile time and side-loaded during static init.\n\n        if (toClone.getJarFileUrls() != null && !toClone.getJarFileUrls().isEmpty()) {\n            throw new UnsupportedOperationException(\"Value found for #getJarFileUrls : not supported yet\");\n        }\n        if (toClone.getJtaDataSource() != null) {\n            throw new UnsupportedOperationException(\"Value found for #getJtaDataSource : not supported yet\");\n        }\n        if (toClone.getNonJtaDataSource() != null) {\n            throw new UnsupportedOperationException(\"Value found for #getNonJtaDataSource : not supported\");\n        }\n    }\n\n    @Override\n    public String toString() {\n        return \"QuarkusPersistenceUnitDescriptor{\" +\n                \"name='\" + name + '\\'' +\n                \", providerClassName='\" + providerClassName + '\\'' +\n                \", useQuotedIdentifiers=\" + useQuotedIdentifiers +\n                \", transactionType=\" + persistenceUnitTransactionType +\n                \", validationMode=\" + validationMode +\n                \", sharedCacheMode=\" + sharedCacheMode +\n                \", managedClassNames=\" + managedClassNames +\n                \", properties=\" + properties +\n                \", isReactive=\" + reactive +","sourceCodeStart":202,"sourceCodeEnd":238,"githubUrl":"https://github.com/quarkusio/quarkus/blob/e1c734241f34c7919086ceb4c9262b4a58f6de44/extensions/hibernate-orm/runtime/src/main/java/io/quarkus/hibernate/orm/runtime/boot/QuarkusPersistenceUnitDescriptor.java#L202-L238","documentation":"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.","triggerScenarios":"A persistence unit descriptor (often produced by external tooling or a custom PersistenceUnitInfo) has setJtaDataSource(...) set when Quarkus clones and validates it at boot.","commonSituations":"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.","solutions":["Leave getJtaDataSource() null and configure the data source with quarkus.datasource.* properties; Quarkus injects it into the persistence unit.","Remove code that calls setJtaDataSource on the descriptor before handing it to Quarkus.","Use quarkus.hibernate.orm.datasource (if needed) to bind the PU to a named Quarkus data source."],"exampleFix":"// before\nPersistenceUnitDescriptor d = ...;\nd.setJtaDataSource(dataSource); // unsupported in Quarkus\n// after\n// application.properties:\n// quarkus.datasource.db-kind=postgresql\n// quarkus.datasource.username=...\n// quarkus.hibernate.orm.datasource=myds\nPersistenceUnitDescriptor d = ...; // no JTA datasource set\n","handlingStrategy":"validation","validationCode":"if (desc.getJtaDataSource() != null) {\n    throw new IllegalStateException(\"Set quarkus.datasource.* config instead of JTA datasource on the descriptor\");\n}","typeGuard":null,"tryCatchPattern":"try {\n    quarkusBoot();\n} catch (UnsupportedOperationException e) {\n    if (e.getMessage().contains(\"getJtaDataSource\")) {\n        log.error(\"Remove setJtaDataSource; configure quarkus.datasource instead\");\n    }\n}","preventionTips":["Do not call setJtaDataSource on descriptors handed to Quarkus","Configure data sources via quarkus.datasource.* properties","Use quarkus.hibernate.orm.datasource to pick a named Quarkus datasource"],"tags":["hibernate-orm","datasource","persistence-xml","unsupported"],"backgroundTag":"unsupported-persistence-unit-descriptor","analyzedSha":"e1c734241f34c7919086ceb4c9262b4a58f6de44","analyzedAt":"2026-09-05T17:01:29.979Z","contentChangedAt":"2026-09-05T17:01:29.979Z","schemaVersion":2},"datasetVersion":"2026-09-14T00:17:10.932Z"}