• 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 Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Tim Cooke
  • Ron McLeod
  • paul wheaton
  • Jeanne Boyarsky
Sheriffs:
  • Paul Clapham
  • Devaka Cooray
Saloon Keepers:
  • Tim Holloway
  • Roland Mueller
  • Himai Minh
Bartenders:

Propagating User Transactions

 
Greenhorn
Posts: 18
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
 
Pratul Chakre
Greenhorn
Posts: 18
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.
Pratul
 
reply
    Bookmark Topic Watch Topic
  • New Topic