I have deployed one transactional remote session bean at server B, which should be executed in caller's transaction context. I am calling this remote session bean from my spring bean, where JTA transaction is already started(TransactionManager is injected from JBossAS). I am doing some database operation in my spring class first and then calling remote session bean with transaction active.
I am getting EjbTransactionRequiredException when method with MANDATORY transaction attribute is called in remote session bean. I doubt that whether transaction context from Spring can be propagated to remote session bean? If this is possible, then what might be going wrong in my case.
I can post code snippets or configuration if required.
I am using JBoss 5.0.1 GA release. When I am calling remote session bean residing in the same server instance, it works perfectly fine but not getting following stack trace when remote session bean is deployed in separate server instance.
Thanks for that link Jaikiran. As far as what I understand from that link is, that example looks up for UserTransaction instance from target ejb server & then controls life cycle of that transaction. I have not tried it that way.
What I exactly intent to achieve is I want to seamlessly have distributed transaction achieved i.e. container should be managing distributed transaction. As shown in the example in previous post, when save() method shown in the snippet is called, spring looks up java:/TransactionManager from local Jboss server(site 1) & transaction is started, it then delegates call to userDao.save() method in remote session bean at Jboss server(site2). I want that in this call, active transaction should be propagated to site 2. Is it possible to achieve?
Have you tried using some other Datasource provider(The one configured using the Driver provided by Database you are using). As you are using a Commons DBCP pool, AFAIK it is the basic implementation of connection pool and datasource. May be you can check with the documentation of DBCP whether this connection can take part in distributed transacation.
Joined: Oct 12, 2008
I have also tried it by injecting MySQL's XA datasource as well as local datasource configured in jboss but got the same result.
I had a similar issue when communicating across Websphere Servers of different versions.
To get it working I had to turn off Transaction Authorization Coordination. Though this sounds like some thing wrong that is what is recommened by IBM.
So you might have something like this to be configured in Jboss.
See if this helps
Joined: Oct 12, 2008
I think that discussion refers to quite older jboss version. I guess JBoss 5.0 supports 2+ jvms & includes arjuna products.
Just want to add one more isolation if someone can give inputs from that. I tried to call that same remote ejb(site 2) from other EJB located at site 1. But getting the same exception. So spring & its injections are not in the picture now. Just I want to have transaction propagation between two remotely located ejbs. I think it is quite common scenario in ejb environment. Eagerly looking for some help.
The ClientUserTransactionService MBean publishes a UserTransaction implementation under the JNDI name UserTransaction.
so it means I need to use BMT to achieve this right?? what if I am using CMT, just like what is shown in the example in the discussion, using java:TransactionManager
The Default Transaction Manager :
While it does support propagating transaction contexts with remote calls, it does not support propagating transaction contexts to other virtual machines, so all transactional work must be done in the same virtual machine as the JBoss server.
I am not able to get what this quote says.
Transaction Propagation :
If transaction contexts are to be propagated with RMI/JRMP calls, the transaction manager must also implement two simple interfaces for the import and export of transaction propagation contexts (TPCs). The interfaces are TransactionPropagationContextImporter, and TransactionPropagationContextFactory, both in the org.jboss.tm package.
These interfaces and their JNDI locations are:
The javax.transaction.TransactionManager interface is used by the application server to manage transactions on behalf of the transactional objects that use container managed transactions. It must be bound under the JNDI name java:/TransactionManager.
The TransactionPropagationContextFactory interface is called by JBoss whenever a transaction propagation context is needed for transporting a transaction with a remote method call. It must be bound under the JNDI name java:/TransactionPropagationContextImporter.
The TransactionPropagationContextImporter interface is called by JBoss whenever a transaction propagation context from an incoming remote method invocation has to be converted to a transaction that can be used within the receiving JBoss server VM.
so that JBoss' implementation of TransactionManager got by java:/TransactionManager doesn't implement TransactionPropagationContextImporter & TransactionPropagationContextFactory interfaces?? what things should I do to have CMT, transaction propagation across remote calls & 2 phase commit?
When studying EJB specs, I thought distributed transaction propagation across remote calls should be seamlessly achieved, without putting much efforts in system level details.