openjpa-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From devu213 <>
Subject Strange behavior with a distributed transaction
Date Thu, 11 Jun 2009 17:11:27 GMT


I have a scenario where I'm trying to run a distributed transaction across
two websphere 6.1 app servers on two different nodes (2 physical machines).
A stateless session bean on server 1 makes an entry to a table in the
database after which it calls the remote ejb on server 2 which again makes
an entry on the same table in the same database.

On server 1

public class ManagerBean implements Manager {
	EntityManager manager;
	public void saveAgreement() {
                       //snip...get the context etc

		try {
		SEPAgreement agreement = new SEPAgreement(786l); //the entity object
		MyRemote remote = (MyRemote) PortableRemoteObject.narrow(
		System.out.println("Cast successful");
		agreement = new SEPAgreement(7864l);
		System.out.println("First call complete");
		SEPAgreement agr1= manager.find(SEPAgreement.class, 786);
		System.out.println("Found first" + agr1);
		SEPAgreement agr2 = manager.find(SEPAgreement.class, 7864);
		System.out.println("Found second" + agr2);
		} catch (Exception e) {


On server 2:

public class MyRemoteImpl implements MyRemote {
	EntityManager manager;
	public void insert(SEPAgreement agreement) {
		System.out.println("In remote");
		System.out.println("Before persist" + agreement);
		try {
			System.out.println("After persist" + agreement);			
		} catch (Exception e) {


In the output on server 1 it prints:
Cast successful
first call complete
found first SEP786

It then hangs until the transaction on the second server times out (for some
strange reason)

In the output on server 2 it prints:
Before persist 7864
After persist 7864
waits...for 60 seconds after which it gives a transaction time out message.

The thing is that the second call to manager.find"() for an object which is
persisted in the remote call causes it to hang. If I comment out the call
everything works fine. Also the noticeable thing is that after the second
server gives a time out message for the transaction, I then see the
remaining sysouts
Found second SEPnull

I am wondering if I'm missing something here. Although I'm not sure if the
second find should have succeeded given that I'm not using a any sort of
distributed cache yet, I don't expect it to hang either. Any ideas? Find the
code attached. 
View this message in context:
Sent from the OpenJPA Users mailing list archive at

View raw message