0 Replies Latest reply: Sep 22, 2011 12:41 PM by Bob McWhirter RSS

Difficulty with XA-DS deployment and UserTransaction

Bob McWhirter Novice

Within TorqueBox (based on AS7), we're deploying XA datasources based on information contained within a user's deployment.

 

We are successfully getting the JDBC Driver (and InstalledDriver) loaded and installed, I think.

 

We're leveraging the AS7 XaDataSourceService in our own DeploymentUnitProcessor to deploy the datasource, and also doing all the BinderService stuff to get it into JNDI, which also seems to work.

 

When we deploy an H2 XA DS, happiness abounds.

 

When we deploy a Postgres XA DS, we see this seemingly harmless stack in our logs:

 

12:15:08,030 ERROR [stderr] (MSC service thread 1-8) java.sql.SQLException: UserTransaction -- service jboss.naming.context.java.UserTransaction
12:15:08,030 ERROR [stderr] (MSC service thread 1-8)    at org.jboss.jca.adapters.jdbc.WrapperDataSource.initUserTransaction(WrapperDataSource.java:266)
12:15:08,030 ERROR [stderr] (MSC service thread 1-8)    at org.jboss.jca.adapters.jdbc.WrapperDataSource.checkTransactionActive(WrapperDataSource.java:222)
12:15:08,031 ERROR [stderr] (MSC service thread 1-8)    at org.jboss.jca.adapters.jdbc.WrappedConnection.checkTransactionActive(WrappedConnection.java:1577)
12:15:08,031 ERROR [stderr] (MSC service thread 1-8)    at org.jboss.jca.adapters.jdbc.WrappedConnection.checkStatus(WrappedConnection.java:1592)
12:15:08,031 ERROR [stderr] (MSC service thread 1-8)    at org.jboss.jca.adapters.jdbc.WrappedConnection.checkTransaction(WrappedConnection.java:1566)
12:15:08,031 ERROR [stderr] (MSC service thread 1-8)    at org.jboss.jca.adapters.jdbc.WrappedConnection.getMetaData(WrappedConnection.java:813)
12:15:08,031 ERROR [stderr] (MSC service thread 1-8)    at arjdbc.jdbc.RubyJdbcConnection.set_native_database_types(RubyJdbcConnection.java:517)

 

Poking through the code, I see AS7DataSourceDeployer calling:

 

managedConnectionFactory.setUserTransactionJndiName("java:comp/UserTransaction");

 

So I'm confused by the lookup the WrapperDataSource is making, which doesn't seem to be "java:comp/UserTransaction".

 

Also, while poking, it seems this whole code-path might only be executed for non-XA DataSource deployments, and if we are trying to deploy XA data-sources, and are getting here, then something's gone wrong.

 

Our DeploymentUnitProcessor which sets up the Service<T> for drivers, datasources and all the JNDI binders is here:

 

https://github.com/torquebox/torquebox/blob/2x-dev/modules/core/src/main/java/org/torquebox/core/datasource/DatabaseProcessor.java

 

I feel like I've missed some service, dependency, or configuration to get this functioning.

 

Thanks for your help.