{"record":{"id":"d48c80e7a2e6bc79","repo":"quarkusio/quarkus","slug":"driver-drivername-is-an-xa-datasource-but-xa-tr","errorCode":null,"errorMessage":"Driver <driverName> is an XA datasource, but XA transactions have not been enabled on the default datasource; please either set 'quarkus.datasource.jdbc.transactions=xa' or switch to a standard non-XA JDBC driver implementation","messagePattern":"Driver <driverName> is an XA datasource, but XA transactions have not been enabled on the default datasource; please either set 'quarkus\\.datasource\\.jdbc\\.transactions=xa' or switch to a standard non-XA JDBC driver implementation","errorType":"validation","errorClass":"ConfigurationException","httpStatus":null,"severity":"error","filePath":"extensions/agroal/deployment/src/main/java/io/quarkus/agroal/deployment/component/DataSourceDefinitionBlockingProcessor.java","lineNumber":226,"sourceCode":"        String driverName = aggregatedConfig.getResolvedDriverClass();\n        Class<?> driver;\n        try {\n            driver = Class.forName(driverName, true, Thread.currentThread().getContextClassLoader());\n        } catch (ClassNotFoundException e) {\n            throw new ConfigurationException(\n                    \"Unable to load the datasource driver \" + driverName + \" for the \" + fullDataSourceName, e);\n        }\n        if (jdbcBuildTimeConfig.transactions() == TransactionIntegration.XA) {\n            if (!XADataSource.class.isAssignableFrom(driver)) {\n                throw new ConfigurationException(\n                        \"Driver is not an XA dataSource, while XA has been enabled in the configuration of the \"\n                                + fullDataSourceName + \": either disable XA or switch the driver to an XADataSource\");\n            }\n        } else {\n            if (driver != null && !javax.sql.DataSource.class.isAssignableFrom(driver)\n                    && !Driver.class.isAssignableFrom(driver)) {\n                if (aggregatedConfig.isDefault()) {\n                    throw new ConfigurationException(\n                            \"Driver \" + driverName\n                                    + \" is an XA datasource, but XA transactions have not been enabled on the default datasource; please either set 'quarkus.datasource.jdbc.transactions=xa' or switch to a standard non-XA JDBC driver implementation\");\n                } else {\n                    throw new ConfigurationException(\n                            \"Driver \" + driverName\n                                    + \" is an XA datasource, but XA transactions have not been enabled on the datasource named '\"\n                                    + fullDataSourceName + \"'; please either set 'quarkus.datasource.\" + fullDataSourceName\n                                    + \".jdbc.transactions=xa' or switch to a standard non-XA JDBC driver implementation\");\n                }\n            }\n        }\n    }\n\n    private String resolveDriver(String dataSourceName, String dbKind,\n            DataSourceJdbcBuildTimeConfig dataSourceJdbcBuildTimeConfig, List<JdbcDriverBuildItem> jdbcDriverBuildItems) {\n        if (dataSourceJdbcBuildTimeConfig.driver().isPresent()) {\n            return dataSourceJdbcBuildTimeConfig.driver().get();\n        }","sourceCodeStart":208,"sourceCodeEnd":244,"githubUrl":"https://github.com/quarkusio/quarkus/blob/e1c734241f34c7919086ceb4c9262b4a58f6de44/extensions/agroal/deployment/src/main/java/io/quarkus/agroal/deployment/component/DataSourceDefinitionBlockingProcessor.java#L208-L244","documentation":"The inverse of the XA mismatch: validateBuildTimeConfig() detects that the configured driver IS an XADataSource while XA transactions were not enabled. For the default datasource it throws this ConfigurationException telling the user to either enable XA or use a non-XA driver.","triggerScenarios":"jdbcBuildTimeConfig.transactions() != XA, the loaded driver is neither javax.sql.DataSource nor java.sql.Driver assignable (i.e. it is an XADataSource), and aggregatedConfig.isDefault() is true.","commonSituations":"Configuring an XA driver class (e.g. org.postgresql.xa.PGXADataSource) but forgetting quarkus.datasource.jdbc.transactions=xa on the default datasource.","solutions":["Set quarkus.datasource.jdbc.transactions=xa on the default datasource.","Or switch to a standard non-XA driver (e.g. org.postgresql.Driver)."],"exampleFix":"// before\nquarkus.datasource.jdbc.driver=org.postgresql.xa.PGXADataSource\n// after\nquarkus.datasource.jdbc.driver=org.postgresql.xa.PGXADataSource\nquarkus.datasource.jdbc.transactions=xa","handlingStrategy":"validation","validationCode":"boolean xa = \"xa\".equals(ConfigProvider.getConfig().getValue(\"quarkus.datasource.jdbc.transactions\", String.class));\nClass<?> d = Class.forName(ConfigProvider.getConfig().getValue(\"quarkus.datasource.jdbc.driver\", String.class));\nif (!xa && javax.sql.XADataSource.class.isAssignableFrom(d)) throw new IllegalStateException(\"XA driver requires transactions=xa\");","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Pair every XA driver class with quarkus.datasource.jdbc.transactions=xa.","Otherwise use the plain non-XA driver class."],"tags":["quarkus","agroal","jdbc","xa","transactions","default-datasource"],"backgroundTag":"xa-driver-mismatch","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"}