• 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
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

how to start a transaction from client side in CMT

 
Ranch Hand
Posts: 393
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I made small program in EJB2.0(Stateful SB and it's CMT ) and it's working fine and transaction attribute is "Required" for the bussinees method. But when i make this transaction attribute "Mandatory" i get the following error :-

Exception message CORBA TRANSACTION_REQUIRED 9998 Maybe

...Now i am thinking what i do that client can start transaction.I am using Sun J2EE server(1.3)..i have checked all the setting,not able to find any option,where client can start transaction ? How client will start transaction ?

Regards,

James
 
james edwin
Ranch Hand
Posts: 393
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
NOW, I have done some R & D and when i call METHOD B() (Tx attribute Mandatory) from Method A() (Tx attribute Required).

Method A(tx attribute Required) calls Method B (tx attribute Mandatory)

It worked...but now the question is if i call Method B directly from JSP or Servlet it throws error.

So is client here means EJB only ? or we can JSP or servlet as a client too when we talk of transactions attributes

Regards,

James
[ June 03, 2004: Message edited by: james edwin ]
 
Greenhorn
Posts: 8
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Mandatory transaction required means, the method for which this attribute has been defined must be called from a transaction and that transaction should have been started from EJB, not from Servlet or JSP
 
Ranch Hand
Posts: 1683
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
The client must be in a transaction, that is why you are getting an exception.

For a client outside the EJB container, you need a UserTransaction in order to start a transaction. I don't know how it works in other containers, but for WebLogic the client uses JNDI to obtain a reference to the UserTransaction object for the WebLogic Server domain. Once this reference is obtained, and cast to UserTransaction, then you invoke its begin() method to start the transaction. The EJB can then be invoked and it will run in the client transaction.
 
james edwin
Ranch Hand
Posts: 393
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi Roger,

Thanks for explaination.But just need one clarification,how can we use JNDI to get reference to UserTransaction ?What all values we put ?

Regards,

James
 
Roger Chung-Wee
Ranch Hand
Posts: 1683
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
The values depend on your system, but here's an example.

 
Consider Paul's rocket mass heater.
reply
    Bookmark Topic Watch Topic
  • New Topic