Transaction being rolled back because of "No EJBReceiver available for node name"?
kieras1 Oct 8, 2012 12:19 PMHi!
I'm trying to implement a distributed transaction call between two EJB's in different standalone servers, both deployed on JBoss AS 7.1.1.Final.
Here is the scenario:
- On "server1" I have deployed an EJB "ejb1" that persist an entity in a database "db1". A remote call on this EJB is working fine from another JBoss AS 7 Server.
- On "server2" I have deployed another EJB "ejb2" that calls "ejb1" and after that persist another entity in a database "db2".
I hope someone can help me on this.
More information:
- The servers are starting with standalone-full configuration;
- The two databases are PostgreSQL, and both JBoss AS Servers (server1 and server2) are configured with XA Datasources;
- The entities are persisted with JPA, and the persistence.xml has "transaction-type=JTA" and a "jta-data-source" declaration to the datasources;
- There is a "remote ejb receiver" configured in "server2" that points to "server1", so any remote ejb calls pass through this connection; On the archive of "ejb2", in directory META-INF, is included a "jboss-ejb-client.xml" configuration file, that points to that connection;
- The "jacorb" subsystem is configured with transactions on:
{code:xml}
<subsystem xmlns="urn:jboss:domain:jacorb:1.1">
<orb>
<initializers security="on" transactions="on"/>
</orb>
</subsystem>
{code}
- The "transactions" subsystem is configured with jts:
{code:xml}
<subsystem xmlns="urn:jboss:domain:transactions:1.1">
<core-environment>
<process-id>
<uuid/>
</process-id>
</core-environment>
<recovery-environment socket-binding="txn-recovery-environment" status-socket-binding="txn-status-manager"/>
<coordinator-environment default-timeout="300"/>
<jts/>
</subsystem>
{code}
- The EJB's are statless session beans;
- On "ejb1" and "ejb2", the EntityManager is injected with @PersistenceContext;
- On "ejb2", the reference to "ejb1" is injected with @EJB(lookup="ejb:/myapp1//EJB1!EJB1Remote"). The injection and any remote calls are working fine;
The code is like this (I have to rename the classes due to confidenciality):
@Stateless
public class EJB1 implements EJB1Remote {
@PersistenceContext
private EntityManager em;
@Override
public void testEjb1(Entity1 entity) throws Exception {
em.persist(entity);
}
}
@Stateless
public class EJB2 {
@PersistenceContext
private EntityManager em;
@EJB(lookup="ejb:/myapp1//EJB1!EJB1Remote")
private EJB1Remote ejb1;
@Override
public void testEjb2(Entity1 entity1) throws Exception {
ejb1.testEjb1(entity1);
Entity2 entity2 = new Entity2(...);
em.persist(entity2);
}
}
On the "server2" logs, there are some messages that could help:
09:22:55,775 DEBUG [org.jboss.as.ejb3.deployment.processors.EJBClientDescriptorMetaDataProcessor] (MSC service thread 1-4) Deployment unit deployment "myapp2.war" will use service jboss.ejb3.dd-based-ejb-client-context."myapp2.war" as the EJB client context service
09:22:55,837 DEBUG [org.jboss.as.ejb3.remote.DescriptorBasedEJBClientContextService] (MSC service thread 1-4) Added a local EJB receiver to descriptor based EJB client context named service jboss.ejb3.dd-based-ejb-client-context."myapp2.war"
09:22:55,837 DEBUG [org.jboss.as.ejb3.remote.DescriptorBasedEJBClientContextService] (MSC service thread 1-4) Creating remoting EJB receiver for connection remote-ejb-connection
09:22:56,337 DEBUG [org.jboss.ejb.client.remoting.RemotingConnectionEJBReceiver] (Remoting "pat38440" task-4) Channel Channel ID e7e4150a (outbound) of Remoting connection 0117b6ce to PAT39450/10.181.77.204:4447 opened for context EJBReceiverContext{clientContext=org.jboss.ejb.client.EJBClientContext@113affb, receiver=Remoting connection EJB receiver [connection=Remoting connection <220e8b>,channel=jboss.ejb,nodename=pat39450]} Waiting for version handshake message from server
09:22:56,353 INFO [org.jboss.ejb.client.remoting.VersionReceiver] (Remoting "pat38440" task-4) Received server version 1 and marshalling strategies [river]
09:22:56,368 INFO [org.jboss.ejb.client.remoting.RemotingConnectionEJBReceiver] (MSC service thread 1-4) Successful version handshake completed for receiver context EJBReceiverContext{clientContext=org.jboss.ejb.client.EJBClientContext@113affb, receiver=Remoting connection EJB receiver [connection=Remoting connection <220e8b>,channel=jboss.ejb,nodename=pat39450]} on channel Channel ID e7e4150a (outbound) of Remoting connection 0117b6ce to PAT39450/10.181.77.204:4447
09:22:56,384 DEBUG [org.jboss.ejb.client.remoting.RemotingConnectionEJBReceiver] (Remoting "pat38440" task-2) Received module availability report for 2 modules
09:22:56,384 DEBUG [org.jboss.ejb.client.remoting.RemotingConnectionEJBReceiver] (Remoting "pat38440" task-2) Registering module EJBModuleIdentifier{appName='jsr-77', moduleName='jsr-77', distinctName=''} availability for receiver context EJBReceiverContext{clientContext=org.jboss.ejb.client.EJBClientContext@113affb, receiver=Remoting connection EJB receiver [connection=Remoting connection <220e8b>,channel=jboss.ejb,nodename=pat39450]}
09:22:56,384 DEBUG [org.jboss.ejb.client.remoting.RemotingConnectionEJBReceiver] (Remoting "pat38440" task-2) Registering module EJBModuleIdentifier{appName='', moduleName='myapp2', distinctName=''} availability for receiver context EJBReceiverContext{clientContext=org.jboss.ejb.client.EJBClientContext@113affb, receiver=Remoting connection EJB receiver [connection=Remoting connection <220e8b>,channel=jboss.ejb,nodename=pat39450]}
09:22:56,400 DEBUG [org.jboss.as.ejb3.remote.DescriptorBasedEJBClientContextService] (MSC service thread 1-4) Added 1 remoting EJB receivers to descriptor based EJB client context named service jboss.ejb3.dd-based-ejb-client-context."myapp2.war"
09:22:56,400 WARN [org.jboss.ejb.client.remoting.ChannelAssociation] (Remoting "pat38440" task-2) Unsupported message received with header 0xffffffff
09:22:56,400 DEBUG [org.jboss.as.ejb3.deployment.processors.EjbClientContextSetupProcessor] (MSC service thread 1-4) Registering EJB client context org.jboss.ejb.client.EJBClientContext@113affb for classloader ModuleClassLoader for Module "deployment.myapp2.war:main" from Service Module Loader
...
09:35:51,259 DEBUG [org.jboss.as.jpa] (Thread-80) created new TransactionScopedEntityManager for unit name=myapp2.war#myds
09:35:51,275 DEBUG [org.jboss.ejb.client.EJBClientContext] (Thread-80) org.jboss.ejb.client.RandomDeploymentNodeSelector@3749d7 deployment node selector selected pat39450 node for appname=,modulename=myapp1,distinctname=
09:35:51,650 DEBUG [org.hibernate.internal.SessionImpl] (Thread-80) Opened session at timestamp: 13496997516
09:35:51,650 DEBUG [org.hibernate.engine.transaction.internal.TransactionCoordinatorImpl] (Thread-80) Skipping JTA sync registration due to auto join checking
09:35:51,665 DEBUG [org.hibernate.engine.transaction.internal.TransactionCoordinatorImpl] (Thread-80) successfully registered Synchronization
09:35:51,665 DEBUG [org.hibernate.ejb.AbstractEntityManagerImpl] (Thread-80) Looking for a JTA transaction to join
09:35:51,681 DEBUG [org.jboss.as.jpa] (Thread-80) Thread-80:[transaction scoped EntityManager]: created entity manager session TransactionImple < jts, 0:ffff0ab54cb6:-294248b6:5072c77e:38 >
09:35:51,697 DEBUG [org.hibernate.engine.jdbc.internal.LogicalConnectionImpl] (Thread-80) Obtaining JDBC connection
…
09:35:52,650 DEBUG [org.hibernate.engine.jdbc.internal.LogicalConnectionImpl] (RequestProcessor-5) Released JDBC connection
09:35:52,665 DEBUG [org.jboss.as.ejb3.remote.TCCLEJBClientContextSelector] (RequestProcessor-5) Returning default EJB client context org.jboss.ejb.client.EJBClientContext@d27bb0 since no EJB client context could be found for TCCL ModuleClassLoader for Module "org.jboss.jts:main" from local module loader @77eaf8 (roots: C:\Prodemge\jboss-as-7.1.1.Final\modules)
09:35:52,681 WARN [com.arjuna.ats.jtax] (RequestProcessor-5) ARJUNA024015: XAResource prepare failed on resource org.jboss.ejb.client.EJBClientManagedTransactionContext$ResourceImpl@14a0173 for transaction < 131072, 29, 36, 0000000000-1-110-7576-74-42-67-737480114-571260005649, 29292929292929292929282839-46105-45-13-38-44103109143-28155292929857829292929292929 > with: -: java.lang.IllegalStateException: No EJBReceiver available for node name pat39450
at org.jboss.ejb.client.EJBClientContext.requireNodeEJBReceiver(EJBClientContext.java:613)
at org.jboss.ejb.client.EJBClientContext.requireNodeEJBReceiverContext(EJBClientContext.java:648)
at org.jboss.ejb.client.EJBClientManagedTransactionContext$ResourceImpl.prepare(EJBClientManagedTransactionContext.java:213)
at com.arjuna.ats.internal.jta.resources.jts.orbspecific.XAResourceRecord.prepare(XAResourceRecord.java:226) [jbossjts-4.16.2.Final.jar:]
at com.arjuna.ArjunaOTS.OTSAbstractRecordPOA._invoke(OTSAbstractRecordPOA.java:83) [jbossjts-4.16.2.Final.jar:]
at org.jacorb.poa.RequestProcessor.invokeOperation(RequestProcessor.java:306) [jacorb-2.3.1.jbossorg-1.jar:]
at org.jacorb.poa.RequestProcessor.process(RequestProcessor.java:614) [jacorb-2.3.1.jbossorg-1.jar:]
at org.jacorb.poa.RequestProcessor.run(RequestProcessor.java:757) [jacorb-2.3.1.jbossorg-1.jar:]
09:35:52,697 WARN [com.arjuna.ats.arjuna] (Thread-80) ARJUNA012073: BasicAction.End() - prepare phase of action-id 0:ffff0ab54cb6:-294248b6:5072c77e:38 failed.
09:35:52,712 WARN [com.arjuna.ats.arjuna] (Thread-80) ARJUNA012075: Action Aborting
09:35:52,712 WARN [com.arjuna.ats.jts] (Thread-80) ARJUNA022223: ExtendedResourceRecord.topLevelAbort caught exception: org.omg.CORBA.UNKNOWN: Server-side Exception: null
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method) [rt.jar:1.6.0_29]
at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:39) [rt.jar:1.6.0_29]
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:27) [rt.jar:1.6.0_29]
at java.lang.reflect.Constructor.newInstance(Constructor.java:513) [rt.jar:1.6.0_29]
at org.jacorb.orb.SystemExceptionHelper.read(SystemExceptionHelper.java:223) [jacorb-2.3.1.jbossorg-1.jar:]
at org.jacorb.orb.ReplyReceiver.getReply(ReplyReceiver.java:319) [jacorb-2.3.1.jbossorg-1.jar:]
at org.jacorb.orb.Delegate.invoke_internal(Delegate.java:1090) [jacorb-2.3.1.jbossorg-1.jar:]
at org.jacorb.orb.Delegate.invoke(Delegate.java:957) [jacorb-2.3.1.jbossorg-1.jar:]
at org.omg.CORBA.portable.ObjectImpl._invoke(ObjectImpl.java:80) [jacorb-2.3.1.jbossorg-1.jar:]
at com.arjuna.ArjunaOTS._ArjunaSubtranAwareResourceStub.rollback(_ArjunaSubtranAwareResourceStub.java:98)
at com.arjuna.ats.internal.jts.resources.ExtendedResourceRecord.topLevelAbort(ExtendedResourceRecord.java:445)
at com.arjuna.ats.arjuna.coordinator.BasicAction.doAbort(BasicAction.java:2874)
at com.arjuna.ats.arjuna.coordinator.BasicAction.doAbort(BasicAction.java:2853)
at com.arjuna.ats.arjuna.coordinator.BasicAction.phase2Abort(BasicAction.java:1908)
at com.arjuna.ats.arjuna.coordinator.BasicAction.End(BasicAction.java:1485)
at com.arjuna.ats.internal.jts.orbspecific.coordinator.ArjunaTransactionImple.commit(ArjunaTransactionImple.java:375)
at com.arjuna.ats.internal.jts.ControlWrapper.commit(ControlWrapper.java:243)
at com.arjuna.ats.internal.jts.orbspecific.CurrentImple.commit(CurrentImple.java:247)
at com.arjuna.ats.jts.extensions.AtomicTransaction.commit(AtomicTransaction.java:276)
at com.arjuna.ats.internal.jta.transaction.jts.TransactionImple.commitAndDisassociate(TransactionImple.java:1290)
at com.arjuna.ats.internal.jta.transaction.jts.BaseTransaction.commit(BaseTransaction.java:130)
at com.arjuna.ats.jbossatx.BaseTransactionManagerDelegate.commit(BaseTransactionManagerDelegate.java:75)
at org.jboss.as.ejb3.tx.CMTTxInterceptor.endTransaction(CMTTxInterceptor.java:92) [jboss-as-ejb3-7.1.1.Final.jar:7.1.1.Final]
at org.jboss.as.ejb3.tx.CMTTxInterceptor.invokeInOurTx(CMTTxInterceptor.java:232) [jboss-as-ejb3-7.1.1.Final.jar:7.1.1.Final]
at org.jboss.as.ejb3.tx.CMTTxInterceptor.required(CMTTxInterceptor.java:304) [jboss-as-ejb3-7.1.1.Final.jar:7.1.1.Final]
at org.jboss.as.ejb3.tx.CMTTxInterceptor.processInvocation(CMTTxInterceptor.java:190) [jboss-as-ejb3-7.1.1.Final.jar:7.1.1.Final]
at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:288) [jboss-invocation-1.1.1.Final.jar:1.1.1.Final]
at org.jboss.as.ejb3.component.interceptors.CurrentInvocationContextInterceptor.processInvocation(CurrentInvocationContextInterceptor.java:41) [jboss-as-ejb3-7.1.1.Final.jar:7.1.1.Final]
at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:288) [jboss-invocation-1.1.1.Final.jar:1.1.1.Final]
at org.jboss.as.ejb3.component.interceptors.LoggingInterceptor.processInvocation(LoggingInterceptor.java:59) [jboss-as-ejb3-7.1.1.Final.jar:7.1.1.Final]
at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:288) [jboss-invocation-1.1.1.Final.jar:1.1.1.Final]
at org.jboss.as.ee.component.NamespaceContextInterceptor.processInvocation(NamespaceContextInterceptor.java:50) [jboss-as-ee-7.1.1.Final.jar:7.1.1.Final]
at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:288) [jboss-invocation-1.1.1.Final.jar:1.1.1.Final]
at org.jboss.as.ejb3.component.interceptors.AdditionalSetupInterceptor.processInvocation(AdditionalSetupInterceptor.java:32) [jboss-as-ejb3-7.1.1.Final.jar:7.1.1.Final]
at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:288) [jboss-invocation-1.1.1.Final.jar:1.1.1.Final]
at org.jboss.as.ee.component.TCCLInterceptor.processInvocation(TCCLInterceptor.java:45) [jboss-as-ee-7.1.1.Final.jar:7.1.1.Final]
at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:288) [jboss-invocation-1.1.1.Final.jar:1.1.1.Final]
at org.jboss.invocation.ChainedInterceptor.processInvocation(ChainedInterceptor.java:61) [jboss-invocation-1.1.1.Final.jar:1.1.1.Final]
at org.jboss.as.ee.component.ViewService$View.invoke(ViewService.java:165) [jboss-as-ee-7.1.1.Final.jar:7.1.1.Final]
at org.jboss.as.ee.component.ViewDescription$1.processInvocation(ViewDescription.java:173) [jboss-as-ee-7.1.1.Final.jar:7.1.1.Final]
at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:288) [jboss-invocation-1.1.1.Final.jar:1.1.1.Final]
at org.jboss.invocation.ChainedInterceptor.processInvocation(ChainedInterceptor.java:61) [jboss-invocation-1.1.1.Final.jar:1.1.1.Final]
at org.jboss.as.ee.component.ProxyInvocationHandler.invoke(ProxyInvocationHandler.java:72) [jboss-as-ee-7.1.1.Final.jar:7.1.1.Final]
at EJB2.save(Unknown Source)
…
09:35:52,806 WARN [com.arjuna.ats.arjuna] (Thread-80) ARJUNA012091: Top-level abort of action 0:ffff0ab54cb6:-294248b6:5072c77e:38 received TwoPhaseOutcome.FINISH_ERROR from com.arjuna.ats.internal.jts.resources.ExtendedResourceRecord
09:35:52,822 DEBUG [org.jboss.jca.core.connectionmanager.pool.strategy.OnePool] (RequestProcessor-5) java:/myds: returnConnection(1ceaf4c, false) [1/19]
09:35:52,837 DEBUG [org.jboss.as.jpa] (RequestProcessor-5) RequestProcessor-5:[transaction scoped EntityManager]: closing entity managersession
09:35:52,853 WARN [com.arjuna.ats.jts] (RequestProcessor-5) ARJUNA022261: ServerTopLevelAction detected that the transaction was inactive
09:35:52,853 DEBUG [org.hibernate.engine.jdbc.internal.JdbcCoordinatorImpl] (RequestProcessor-5) HHH000420: Closing un-released batch
09:35:52,853 DEBUG [org.hibernate.engine.jdbc.internal.LogicalConnectionImpl] (RequestProcessor-5) Aggressively releasing JDBC connection
09:35:52,931 ERROR [org.jboss.ejb3.invocation] (Thread-80) JBAS014134: EJB Invocation failed on component EJB2 for method public abstract void testEjb2(Entity1) throws java.lang.Exception: javax.ejb.EJBTransactionRolledbackException: Transaction rolled back
at org.jboss.as.ejb3.tx.CMTTxInterceptor.handleEndTransactionException(CMTTxInterceptor.java:115) [jboss-as-ejb3-7.1.1.Final.jar:7.1.1.Final]
at org.jboss.as.ejb3.tx.CMTTxInterceptor.endTransaction(CMTTxInterceptor.java:95) [jboss-as-ejb3-7.1.1.Final.jar:7.1.1.Final]
at org.jboss.as.ejb3.tx.CMTTxInterceptor.invokeInOurTx(CMTTxInterceptor.java:232) [jboss-as-ejb3-7.1.1.Final.jar:7.1.1.Final]
at org.jboss.as.ejb3.tx.CMTTxInterceptor.required(CMTTxInterceptor.java:304) [jboss-as-ejb3-7.1.1.Final.jar:7.1.1.Final]
at org.jboss.as.ejb3.tx.CMTTxInterceptor.processInvocation(CMTTxInterceptor.java:190) [jboss-as-ejb3-7.1.1.Final.jar:7.1.1.Final]
at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:288) [jboss-invocation-1.1.1.Final.jar:1.1.1.Final]
at org.jboss.as.ejb3.component.interceptors.CurrentInvocationContextInterceptor.processInvocation(CurrentInvocationContextInterceptor.java:41) [jboss-as-ejb3-7.1.1.Final.jar:7.1.1.Final]
at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:288) [jboss-invocation-1.1.1.Final.jar:1.1.1.Final]
at org.jboss.as.ejb3.component.interceptors.LoggingInterceptor.processInvocation(LoggingInterceptor.java:59) [jboss-as-ejb3-7.1.1.Final.jar:7.1.1.Final]
at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:288) [jboss-invocation-1.1.1.Final.jar:1.1.1.Final]
at org.jboss.as.ee.component.NamespaceContextInterceptor.processInvocation(NamespaceContextInterceptor.java:50) [jboss-as-ee-7.1.1.Final.jar:7.1.1.Final]
at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:288) [jboss-invocation-1.1.1.Final.jar:1.1.1.Final]
at org.jboss.as.ejb3.component.interceptors.AdditionalSetupInterceptor.processInvocation(AdditionalSetupInterceptor.java:32) [jboss-as-ejb3-7.1.1.Final.jar:7.1.1.Final]
at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:288) [jboss-invocation-1.1.1.Final.jar:1.1.1.Final]
at org.jboss.as.ee.component.TCCLInterceptor.processInvocation(TCCLInterceptor.java:45) [jboss-as-ee-7.1.1.Final.jar:7.1.1.Final]
at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:288) [jboss-invocation-1.1.1.Final.jar:1.1.1.Final]
at org.jboss.invocation.ChainedInterceptor.processInvocation(ChainedInterceptor.java:61) [jboss-invocation-1.1.1.Final.jar:1.1.1.Final]
at org.jboss.as.ee.component.ViewService$View.invoke(ViewService.java:165) [jboss-as-ee-7.1.1.Final.jar:7.1.1.Final]
at org.jboss.as.ee.component.ViewDescription$1.processInvocation(ViewDescription.java:173) [jboss-as-ee-7.1.1.Final.jar:7.1.1.Final]
at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:288) [jboss-invocation-1.1.1.Final.jar:1.1.1.Final]
at org.jboss.invocation.ChainedInterceptor.processInvocation(ChainedInterceptor.java:61) [jboss-invocation-1.1.1.Final.jar:1.1.1.Final]
at org.jboss.as.ee.component.ProxyInvocationHandler.invoke(ProxyInvocationHandler.java:72) [jboss-as-ee-7.1.1.Final.jar:7.1.1.Final]
at EJB2.save(Unknown Source)
…
Caused by: javax.transaction.RollbackException: org.omg.CORBA.TRANSACTION_ROLLEDBACK
at com.arjuna.ats.internal.jta.transaction.jts.TransactionImple.commitAndDisassociate(TransactionImple.java:1318)
at com.arjuna.ats.internal.jta.transaction.jts.BaseTransaction.commit(BaseTransaction.java:130)
at com.arjuna.ats.jbossatx.BaseTransactionManagerDelegate.commit(BaseTransactionManagerDelegate.java:75)
at org.jboss.as.ejb3.tx.CMTTxInterceptor.endTransaction(CMTTxInterceptor.java:92) [jboss-as-ejb3-7.1.1.Final.jar:7.1.1.Final]
... 27 more
I don't know where else to look for to solve this problem.
Please ask for any other configuration or logs you want to see.
Thank you,
Kieras.