I am trying to check how user transactions work in context of the OC4j Containers.
I have deployed a Stateless Session Bean in the 'standalone' OC4J container of JDev10.1.3. I then exposed the EJB as a WebService.
Next, I wrote a client and am running it in the 'embedded' OC4J container of JDev 10.1.3. From this client, I am trying to invoke the bean methods as WebService calls. Below is my client code:
<code> env.put(Context.INITIAL_CONTEXT_FACTORY, "com.evermind.server.rmi.RMIInitialContextFactory"); env.put(Context.PROVIDER_URL, "ormi://localhost:23791/"); env.put(Context.SECURITY_PRINCIPAL, "oc4jadmin"); env.put(Context.SECURITY_CREDENTIALS, "welcome"); Context context = new InitialContext(env); ut = (UserTransaction) context.lookup("java:comp/UserTransaction"); ut.begin();
// call bean methods.
ut.commit(); </code> However, I am not able to look up the JNDI Name for UserTransaction in the embedded OC4J. I tried both "java:comp/UserTransaction" and "jta/usertransaction".
Could somebody please let me know how to lookup the User Transaction from the Context in OC4J?
Also, I read somewhere that UserTransactions (begin .. method .. commit/rollback) is not supported in OC4J unless the EJB are running in the same container? Is this true? In which case, my above test scenario would never work, is it?
but to no avail. I was, however, able to retrieve the Transaction Manager context in standalone OC4J container.
Somebody please help as I have practially gone berserk trying all possible combinations for the JNDI names. All I am trying to do is lookup the TransactionManager (or UserTransaction) in the embedded OC4J container of JDev 10.1.3.
Many thanks in anticipation. Pratul
You showed up just in time for the waffles! And this tiny ad:
Building a Better World in your Backyard by Paul Wheaton and Shawn Klassen-Koop