geronimo-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Diego Munguia <>
Subject client managed distributed transactions
Date Fri, 08 May 2009 23:20:16 GMT

I have a spring-based application that connects to a local database and to a set of remote
EJBs that are deployed on a Geronimo 2.1.4 server. I'm trying to configure a transaction manager
that handles distributed transactions, because on a single service method I may have calls
to the local db and to one or more EJBs (stateless session beans).

I've managed to configure distributed transactions in the past using Jencks and the Geronimo
TM but for local datasources (1 mysql db and 1 jackrabbit repository), this configuration
required the use of a UserTransaction object, I used spring's jndi mock functionality as I
wasn't using a j2ee server. 

I'm trying to replicate this conf on my current app but my problem is that I can't get a hold
of the remote UserTransaction object via jndi. This is how I'm trying to retrieve it:

        Properties properties = new Properties();
        properties.put(Context.INITIAL_CONTEXT_FACTORY, "org.apache.openejb.client.RemoteInitialContextFactory");
        properties.put("java.naming.provider.url", "ejbd://localhost:4201");
        Context context = new InitialContext(properties);

I'm getting this exception:

Exception in thread "main" javax.naming.NameNotFoundException: comp/UserTransaction does not
exist in the system.  Check that the app was successfully deployed.
	at org.apache.openejb.client.JNDIContext.lookup(
	at javax.naming.InitialContext.lookup(

If I go to the Geronimo console and look for UserTransaction using the JNDI Viewer I see that
there is an user transaction object under the name java:comp/UserTransaction, so I'm guessing
I'm using the correct jndi name on my code. Plus the app successfully retrieves the ejb proxies
so I know the jndi service is up and running. 

How can I retrieve the user transaction then? If there's a reason why the user transaction
is not provided for remote clients then does anybody knows of an alternative strategy to do
client-managed transactions or any other kind of distributed transactions strategy that allows
me to keep track of my local db changes as well the ejbs on the same transaction?

- Diego M.

View raw message