Failed to get the second сonnection in the same transaction

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

Failed to get the second сonnection in the same transaction

alexey-s
This post has NOT been accepted by the mailing list yet.
Simplistically, there LocalXA wrapped DataSource. Created with ConnectionManagerFactory.
As part of the current transaction have to open a connection twice.
@Reference(target = "(&(filter=myds)(aries.managed=true))")
DataSource ds_a;
@Reference(target = "(&(filter=myds)(aries.managed=true))")
DataSource ds_b;

//  @Transactional(value = TxType.REQUIRED)

Connection c_a = ds_a.getConnection();
Connection c_b = ds_b.getConnection();
Practically, it is different OSGI components that run in a single transaction.
When you try to open a second connection, I receive an error
org.apache.geronimo.connector.outbound.LocalXAResource@7e41ac14, errorCode: 0
javax.transaction.xa.XAException: already enlisted
    at org.apache.geronimo.connector.outbound.LocalXAResource.start(LocalXAResource.java:103)[79:org.apache.geronimo.components.geronimo-connector:3.1.1]
    at org.apache.geronimo.transaction.manager.TransactionImpl.enlistResource(TransactionImpl.java:209)[49:org.apache.aries.transaction.manager:1.3.0]
    at org.apache.geronimo.connector.outbound.TransactionEnlistingInterceptor.getConnection(TransactionEnlistingInterceptor.java:60)[79:org.apache.geronimo.components.geronimo-connector:3.1.1]
    at org.apache.geronimo.connector.outbound.TransactionCachingInterceptor.getConnection(TransactionCachingInterceptor.java:101)[79:org.apache.geronimo.components.geronimo-connector:3.1.1]
    at org.apache.geronimo.connector.outbound.ConnectionHandleInterceptor.getConnection(ConnectionHandleInterceptor.java:43)[79:org.apache.geronimo.components.geronimo-connector:3.1.1]
    at org.apache.geronimo.connector.outbound.TCCLInterceptor.getConnection(TCCLInterceptor.java:39)[79:org.apache.geronimo.components.geronimo-connector:3.1.1]
    at org.apache.geronimo.connector.outbound.ConnectionTrackingInterceptor.getConnection(ConnectionTrackingInterceptor.java:66)[79:org.apache.geronimo.components.geronimo-connector:3.1.1]
    at org.apache.geronimo.connector.outbound.AbstractConnectionManager.allocateConnection(AbstractConnectionManager.java:81)[79:org.apache.geronimo.components.geronimo-connector:3.1.1]
    at org.tranql.connector.jdbc.TranqlDataSource.getConnection(TranqlDataSource.java:62)[48:org.apache.aries.transaction.jdbc:2.1.0]