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

Asked

Viewed 174 times

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 to its own Datasource and also save some other data to another application by calling EJB methods, which will use another Datasource. The two Datasources are set to use JTA (JTA checkbox marked in Jboss configuration).

Only in cases of update, the attempt 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 goes away.

What’s wrong with my settings?

Thanks in advance!

1 answer

1


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

  • Add to file pom.xml dependence on extension demoiselle-jta : <dependency> <groupId>br.gov.frameworkdemoiselle</groupId> <artifactId>demoiselle-jta</artifactId> <scope>compile</scope> </dependency>
  • Report in the archive persistence.xml 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 the property: <property name="hibernate.transaction.jta.platform" value="org.hibernate.service.jta.platform.internal.JBossAppServerJtaPlatform" />

More details on the link above.

Browser other questions tagged

You are not signed in. Login or sign up in order to post.