File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes EJB and other Java EE Technologies and the fly likes Promlem with Transactions in EJB Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Java » EJB and other Java EE Technologies
Bookmark "Promlem with Transactions in EJB" Watch "Promlem with Transactions in EJB" New topic

Promlem with Transactions in EJB

Dilip Maddala

Joined: Apr 03, 2008
Posts: 2

I am facing a problem with using SessionContext's setRollbackOnly method.
I am having 3 EJB's(Suppose A,B,C) in which A calls a method in B and this method calls a method in C.
I perform a database operation, where it waits for a lock and finally database transaction times out and finally the exception is passed back to A.
And finally in A, i call the setRollbackOnly method, where it throws the java.lang.IllegalStateException saying 'Cannot mark the transaction for rollback'.

All the three beans are container managed and i have a transaction attribute 'Required' set in the descriptor file.

Can some one help me out with this.

Roger Chung-Wee
Ranch Hand

Joined: Sep 29, 2002
Posts: 1683
When the transaction times out, there is nothing to rollback. Usually, 30 seconds is plenty of time for a transaction to complete (this is the default transaction timeout for some EJB servers). If it taking longer, you need to find out why.

SCJP 1.4, SCWCD 1.3, SCBCD 1.3
Dilip Maddala

Joined: Apr 03, 2008
Posts: 2
The problem is solved but
I have this EJB as a webservice which and when the Transaction is Timed out in the EJB, the same exception is being thrown at the soap client as response.
I agree. Here's the link:
subject: Promlem with Transactions in EJB
Similar Threads
Transaction EJB
setRollbackOnly() related question
Facing Issue while spring transaction roll back.
Transaction in MDB