0 Replies Latest reply on Jan 17, 2019 3:45 AM by Emerson Sanchez

    Multiple JTA Datasources in JBoss 7. Is it allowed?

    Emerson Sanchez Newbie

      I once read that multiple JTA datasources are not allowed. Can anyone please confirm if what I remember is right? I can't find any documentation that says this anymore. Reason is we are currently trying to add another EJB module in our system that must use another JTA datasource and we are experiencing error below.

       

      Caused by: <openjpa-3.0.0-r422266:1833209 fatal general error> org.apache.openjpa.persistence.PersistenceException: IJ031070: Transaction cannot proceed: STATUS_MARKED_ROLLBACK

      at org.apache.openjpa.jdbc.sql.DBDictionary.narrow(DBDictionary.java:5038)

      at org.apache.openjpa.jdbc.sql.DBDictionary.newStoreException(DBDictionary.java:4998)

      at org.apache.openjpa.jdbc.sql.SQLExceptions.getStore(SQLExceptions.java:134)

      at org.apache.openjpa.jdbc.sql.SQLExceptions.getStore(SQLExceptions.java:107)

      at org.apache.openjpa.jdbc.sql.SQLExceptions.getStore(SQLExceptions.java:59)

      at org.apache.openjpa.jdbc.kernel.JDBCStoreManager.connect(JDBCStoreManager.java:970)

      at org.apache.openjpa.jdbc.kernel.JDBCStoreManager.retainConnection(JDBCStoreManager.java:227)

      at org.apache.openjpa.kernel.DelegatingStoreManager.retainConnection(DelegatingStoreManager.java:164)

      at org.apache.openjpa.kernel.BrokerImpl.retainConnection(BrokerImpl.java:4026)

      at org.apache.openjpa.kernel.BrokerImpl.beginStoreManagerTransaction(BrokerImpl.java:1447)

      at org.apache.openjpa.kernel.BrokerImpl.beginInternal(BrokerImpl.java:1384)

      at org.apache.openjpa.kernel.BrokerImpl.initialize(BrokerImpl.java:400)

      at org.apache.openjpa.kernel.BrokerImpl.initialize(BrokerImpl.java:325)

      at org.apache.openjpa.kernel.AbstractBrokerFactory.initializeBroker(AbstractBrokerFactory.java:228)

      at org.apache.openjpa.kernel.AbstractBrokerFactory.newBroker(AbstractBrokerFactory.java:212)

      at org.apache.openjpa.kernel.DelegatingBrokerFactory.newBroker(DelegatingBrokerFactory.java:154)

      at org.apache.openjpa.persistence.EntityManagerFactoryImpl.createEntityManager(EntityManagerFactoryImpl.java:246)

      at org.apache.openjpa.persistence.EntityManagerFactoryImpl.createEntityManager(EntityManagerFactoryImpl.java:162)

      at org.apache.openjpa.persistence.EntityManagerFactoryImpl.createEntityManager(EntityManagerFactoryImpl.java:152)

      at org.apache.openjpa.persistence.EntityManagerFactoryImpl.createEntityManager(EntityManagerFactoryImpl.java:58)

      at org.jboss.as.jpa.container.TransactionScopedEntityManager.createEntityManager(TransactionScopedEntityManager.java:187)

      at org.jboss.as.jpa.container.TransactionScopedEntityManager.getOrCreateTransactionScopedEntityManager(TransactionScopedEntityManager.java:157)

      at org.jboss.as.jpa.container.TransactionScopedEntityManager.getEntityManager(TransactionScopedEntityManager.java:87)

      at org.jboss.as.jpa.container.AbstractEntityManager.merge(AbstractEntityManager.java:565)

      at com.silverlakesymmetri.bpp.core.persistence.ProcessPersistence.createProcessInstance(ProcessPersistence.java:49)

      at com.silverlakesymmetri.bpp.ejb.persistence.ProcessPersistenceEJB.createProcessInstance(ProcessPersistenceEJB.java:31)

      at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)

      at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)

      at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)

      at java.lang.reflect.Method.invoke(Method.java:498)

      at org.jboss.as.ee.component.ManagedReferenceMethodInterceptor.processInvocation(ManagedReferenceMethodInterceptor.java:52)

      at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:422)

      at org.jboss.invocation.InterceptorContext$Invocation.proceed(InterceptorContext.java:509)

      at org.jboss.as.weld.interceptors.Jsr299BindingsInterceptor.doMethodInterception(Jsr299BindingsInterceptor.java:90)

      at org.jboss.as.weld.interceptors.Jsr299BindingsInterceptor.processInvocation(Jsr299BindingsInterceptor.java:101)

      at org.jboss.as.ee.component.interceptors.UserInterceptorFactory$1.processInvocation(UserInterceptorFactory.java:63)

      at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:422)

      at org.jboss.as.ejb3.component.invocationmetrics.ExecutionTimeInterceptor.processInvocation(ExecutionTimeInterceptor.java:43)

      at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:422)

      at org.jboss.as.jpa.interceptor.SBInvocationInterceptor.processInvocation(SBInvocationInterceptor.java:47)

      at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:422)

      at org.jboss.as.ee.concurrent.ConcurrentContextInterceptor.processInvocation(ConcurrentContextInterceptor.java:45)

      at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:422)

      at org.jboss.invocation.InitialInterceptor.processInvocation(InitialInterceptor.java:40)

      at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:422)

      at org.jboss.invocation.ChainedInterceptor.processInvocation(ChainedInterceptor.java:53)

      at org.jboss.as.ee.component.interceptors.ComponentDispatcherInterceptor.processInvocation(ComponentDispatcherInterceptor.java:52)

      at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:422)

      at org.jboss.as.ejb3.component.pool.PooledInstanceInterceptor.processInvocation(PooledInstanceInterceptor.java:51)

      at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:422)

      at org.jboss.as.ejb3.tx.CMTTxInterceptor.invokeInCallerTx(CMTTxInterceptor.java:255)

      ... 245 more

      Caused by: java.sql.SQLException: IJ031070: Transaction cannot proceed: STATUS_MARKED_ROLLBACK

      at org.jboss.jca.adapters.jdbc.WrapperDataSource.checkTransactionActive(WrapperDataSource.java:245)

      at org.jboss.jca.adapters.jdbc.WrappedConnection.checkTransactionActive(WrappedConnection.java:1928)

      at org.jboss.jca.adapters.jdbc.WrappedConnection.checkStatus(WrappedConnection.java:1943)

      at org.jboss.jca.adapters.jdbc.WrappedConnection.setTransactionIsolation(WrappedConnection.java:1005)

      at org.apache.openjpa.lib.jdbc.DelegatingConnection.setTransactionIsolation(DelegatingConnection.java:226)

      at org.apache.openjpa.lib.jdbc.DelegatingConnection.setTransactionIsolation(DelegatingConnection.java:226)

      at org.apache.openjpa.lib.jdbc.ConfiguringConnectionDecorator.decorate(ConfiguringConnectionDecorator.java:94)

      at org.apache.openjpa.lib.jdbc.DecoratingDataSource.decorate(DecoratingDataSource.java:98)

      at org.apache.openjpa.lib.jdbc.DecoratingDataSource.getConnection(DecoratingDataSource.java:87)

      at org.apache.openjpa.jdbc.kernel.JDBCStoreManager.connectInternal(JDBCStoreManager.java:981)

      at org.apache.openjpa.jdbc.kernel.JDBCStoreManager.connect(JDBCStoreManager.java:966)

      ... 290 more

       

       

       

      I can also this warnings in our logs:

       

      2019-01-17 15:59:36,053 WARN  [com.arjuna.ats.arjuna] (EJB default - 5) ARJUNA012140: Adding multiple last resources is disallowed. Trying to add LastResourceRecord(XAOnePhaseResource(LocalXAResourceImpl@5cb58eb4[connectionListener=2680dc2f connectionManager=71c3fbd8 warned=false currentXid=< formatId=131077, gtrid_length=29, bqual_length=36, tx_uid=0:ffff0afdb2bd:505d1fc3:5c40349c:57f, node_name=1, branch_uid=0:ffff0afdb2bd:505d1fc3:5c40349c:58e, subordinatenodename=null, eis_name=java:/jdbc/BPPDataSource > productName=Oracle productVersion=Oracle Database 11g Enterprise Edition Release 11.2.0.1.0 - Production

      With the Partitioning, OLAP, Data Mining and Real Application Testing options jndiName=java:/jdbc/BPPDataSource])), but already have LastResourceRecord(XAOnePhaseResource(LocalXAResourceImpl@65bcef0[connectionListener=56556f53 connectionManager=38be9134 warned=false currentXid=< formatId=131077, gtrid_length=29, bqual_length=36, tx_uid=0:ffff0afdb2bd:505d1fc3:5c40349c:57f, node_name=1, branch_uid=0:ffff0afdb2bd:505d1fc3:5c40349c:587, subordinatenodename=null, eis_name=java:jboss/datasources/amm_schema > productName=Oracle productVersion=Oracle Database 11g Enterprise Edition Release 11.2.0.1.0 - Production

      With the Partitioning, OLAP, Data Mining and Real Application Testing options jndiName=java:jboss/datasources/amm_schema]))

       

      Thanks in advance,

      Emerson