How to configure JBoss AS 7.1 with Demoiselle 2.4.1 to operate with distributed transactions?

1

Hello

My scenario: JSF / Demoiselle application that invokes an EJB method, both hosted on a JBoss AS 7.1.1 server. During insert and update operations on a CRUD page, the Demoiselle application has to save its data in its own DataSource and also save some other data in another application by calling EJB methods, which will use another DataSource. The two DataSources are configured to use JTA (JTA checkbox checked in JBoss configuration).

Only in cases of update , attempting to save data throws an exception. The last parts of the exception stack follow:

Caused by: java.sql.SQLException: javax.resource.ResourceException: IJ000457: Unchecked throwable in managedConnectionReconnected() cl=org.jboss.jca.core.connectionmanager.listener.TxConnectionListener@14729cfa[state=NORMAL managed connection=org.jboss.jca.adapters.jdbc.local.LocalManagedConnection@6a370d1a connection handles=0 lastUse=1467805740289 trackByTx=false pool=org.jboss.jca.core.connectionmanager.pool.strategy.OnePool@7a5d9cca pool internal context=SemaphoreArrayListManagedConnectionPool@31c571ea[pool=CartaoDS] xaResource=LocalXAResourceImpl@11061a5f[connectionListener=14729cfa connectionManager=4b45c7aa warned=false currentXid=null] txSync=null]
at org.jboss.jca.adapters.jdbc.WrapperDataSource.getConnection(WrapperDataSource.java:147)
at org.hibernate.service.jdbc.connections.internal.DatasourceConnectionProviderImpl.getConnection(DatasourceConnectionProviderImpl.java:141)
at org.hibernate.internal.AbstractSessionImpl$NonContextualJdbcConnectionAccess.obtainConnection(AbstractSessionImpl.java:281)
at org.hibernate.engine.jdbc.internal.LogicalConnectionImpl.obtainConnection(LogicalConnectionImpl.java:297)
... 175 more
Caused by: javax.resource.ResourceException: IJ000457: Unchecked throwable in managedConnectionReconnected() cl=org.jboss.jca.core.connectionmanager.listener.TxConnectionListener@14729cfa[state=NORMAL managed connection=org.jboss.jca.adapters.jdbc.local.LocalManagedConnection@6a370d1a connection handles=0 lastUse=1467805740289 trackByTx=false pool=org.jboss.jca.core.connectionmanager.pool.strategy.OnePool@7a5d9cca pool internal context=SemaphoreArrayListManagedConnectionPool@31c571ea[pool=CartaoDS] xaResource=LocalXAResourceImpl@11061a5f[connectionListener=14729cfa connectionManager=4b45c7aa warned=false currentXid=null] txSync=null]
at org.jboss.jca.core.connectionmanager.AbstractConnectionManager.reconnectManagedConnection(AbstractConnectionManager.java:604)
at org.jboss.jca.core.connectionmanager.AbstractConnectionManager.allocateConnection(AbstractConnectionManager.java:467)
at org.jboss.jca.adapters.jdbc.WrapperDataSource.getConnection(WrapperDataSource.java:139)
... 178 more
Caused by: javax.resource.ResourceException: IJ000461: Could not enlist in transaction on entering meta-aware object
at org.jboss.jca.core.connectionmanager.tx.TxConnectionManagerImpl.managedConnectionReconnected(TxConnectionManagerImpl.java:474)
at org.jboss.jca.core.connectionmanager.AbstractConnectionManager.reconnectManagedConnection(AbstractConnectionManager.java:599)
... 180 more
Caused by: javax.transaction.SystemException: IJ000356: Failed to enlist: java.lang.Throwable: Unabled to enlist resource, see the previous warnings. tx=TransactionImple < ac, BasicAction: 0:ffff0a0a0546:2fd05d09:577134fa:61c7a status: ActionStatus.ABORT_ONLY >
at org.jboss.jca.core.connectionmanager.listener.TxConnectionListener$TransactionSynchronization.checkEnlisted(TxConnectionListener.java:552)
at org.jboss.jca.core.connectionmanager.listener.TxConnectionListener.enlist(TxConnectionListener.java:282)
at org.jboss.jca.core.connectionmanager.tx.TxConnectionManagerImpl.managedConnectionReconnected(TxConnectionManagerImpl.java:467)
... 181 more

When I disable JTA in the EJB DataSource the problem disappears.

What's wrong with my settings?

Thank you in advance!

    
asked by anonymous 06.07.2016 / 14:32

1 answer

1

According to the official documentation , the configuration is done with the following steps:

  • Add in the pom.xml file the dependency to the demoiselle-jta extension: <dependency> <groupId>br.gov.frameworkdemoiselle</groupId> <artifactId>demoiselle-jta</artifactId> <scope>compile</scope> </dependency>
  • Inform the persistence.xml file of the address of the managed JTA connection. In the specific case of JBoss and Hibernate, it looks like this:

    • Transaction type: <persistence-unit name="bookmark-ds" transaction-type="JTA">

    • Datasource JTA: <jta-data-source>java:jboss/datasources/ExampleDS</jta-data-source>

    • Set property: <property name="hibernate.transaction.jta.platform" value="org.hibernate.service.jta.platform.internal.JBossAppServerJtaPlatform" />

More details at the link above.

    
05.05.2017 / 15:10