• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
  • Campbell Ritchie
  • Liutauras Vilda
  • Tim Cooke
  • Jeanne Boyarsky
  • Bear Bibeault
  • Knute Snortum
  • paul wheaton
  • Devaka Cooray
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Ron McLeod
  • Piet Souris
  • Ganesh Patekar
  • Tim Holloway
  • Carey Brown
  • salvin francis

Propagating User Transactions

Posts: 18
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

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:

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");

// call bean methods.

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.

Pratul Chakre
Posts: 18
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Ok, so I googled and found that Oracle started supporting transaction propagation since OC4J 10.1.3.

But I am still unable to fetch the Trnasaction Manager using JNDI lookup, in the embedded OC4J container of JDeveloper 10.1.3. I have tried the following:

--> java:comp/UserTransaction
--> java:comp/pm/TransactionManager
--> java:comp/env/UserTransaction
--> java:comp/env/pm/UserTransaction.

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.
We don't have time for this. We've gotta save the moon! Or check this out:
Java file APIs (DOC, XLS, PDF, and many more)
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!