Hi,
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?
Many thanks in Advance.
Regards,
Pratul