I'm trying to get the EAP quickstart jta-crash-rec to start with Swarm, like this:
- git clone -b 7.0.x https://github.com/jboss-developer/jboss-eap-quickstarts.git
- cd jboss-eap-quickstarts/jta-crash-rec
- mvn clean package
- wget https://repo1.maven.org/maven2/org/wildfly/swarm/swarmtool/2017.3.3/swarmtool-2017.3.3-standalone.jar
- java -jar swarmtool-2017.3.3-standalone.jar -d com.h2database:h2:1.4.193 target/jboss-jta-crash-rec.war
- java -jar jboss-jta-crash-rec-swarm.jar
The uberjar fails to boot (actually fails to deploy the application) with a bunch of errors. The first one, which is the only one important, reads:
Looking at XAManagedConnectionFactory.getXADataSource, this actually means that the name of the XA datasource class isn't configured. However, the uberjar boot logs clearly shows that the H2 JDBC driver was autodetected, and Swarm's H2DriverInfo clearly has:
So this should work, but doesn't. I'm looking at the EAP documentation that has instructions how to create datasources and JDBC drivers: https://access.redhat.com/documentation/en-us/red_hat_jboss_enterprise_application_platform/7.0/html/configuration_guide/datasource_management#example_datasource_configurations
There, they don't use the xa-datasource-class mgmt attribute, they only use driver-xa-datasource-class-name. I tried to register a JDBC driver with both attributes and the xa-datasource-class one isn't even persisted to standalone.xml; instead, what get's persisted as the <xa-datasource-class> XML element is the driver-xa-datasource-class-name mgmt attribute. This is clearly a WildFly mgmt model usability bug.
I tried to change H2DriverInfo to call driver.driverXaDatasourceClassName("org.h2.jdbcx.JdbcDataSource"); instead and the quickstart uberjar starts just fine.
To me, this sounds like we're registering JDBC drivers using wrong mgmt attribute, but for some reason, it seems work just fine in non-XA scenarios? I'm no expert on the datasources subsystem, so CCing Stefano Maestri.