geronimo-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Darv <>
Subject EJB Transaction inter server propagation
Date Wed, 13 Aug 2014 14:11:54 GMT
I am having some difficulty with transaction propagation between two EJBs on
seperate servers (which I understand can be done based on section 13.2.3 of
the EJB3.1 spec), and I would appreciate if some who might have done this,
could help me.

I am a bit green with EJBs so please excuse me. My initial thought was to
use RemoteInitialContextFactory to initiate the context and then lookup the
remote EJB. While the EJBs communicate ok, unfortunately the transaction
does not propagate, even if the 2 EJB's are on the same server (but
different projects). The @EJB annotation on the remote interface however
does propagate the transaction when on the same machine (diff projects).

The prototype code below is where MyFirstEjbBean saves a customer and then
calls MySecondEjbBean which save another customer on a seperate schema.
MyFirstEjbBean can then blow up to test the rollback. What annotations and
xml definitions are required to enable this to work inter servers? An
example would be greatly appreciated.

public class MyFirstEjbBean implements MyFirstEjb, MyFirstEjbRemote {
	private EntityManager em;
	MySecondEjbRemote mySecondEjb;
	public void saveCustomers(){  
		Customer customer = new Customer("name1", "address1", "city1");  
//		throw new IllegalStateException("Blowing up!");		

public class MySecondEjbBean implements MySecondEjb, MySecondEjbRemote {
	private EntityManager em;

	public void saveCustomer() {
		// TODO Auto-generated method stub
		Customer cust2 = new Customer("name2", "addr2","city2");


<?xml version="1.0" encoding="UTF-8"?>
<persistence version="2.1" xmlns=""
	<persistence-unit name="EJBPrototypesPU" transaction-type="JTA">
  			<property name="openjpa.jdbc.SynchronizeMappings"
  			<property name="openjpa.Sequence" value="table(Table=OPENJPASEQ,
  			<property name="openjpa.Log" value="DefaultLevel=WARN, Runtime=TRACE,
Tool=INFO"/>  		</properties>  		


Note: I am using Geronimo 3.0.1 which supports EJB3.1.

View this message in context:
Sent from the Users mailing list archive at

View raw message