File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes BEA/Weblogic and the fly likes How to catch EJB Transaction Timeout? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Products » BEA/Weblogic
Bookmark "How to catch EJB Transaction Timeout?" Watch "How to catch EJB Transaction Timeout?" New topic

How to catch EJB Transaction Timeout?

Alan A Smith

Joined: Apr 25, 2003
Posts: 21
is the following true as regards to transaction timeouts.
The descriptor is set as:


The actual transaction takes 3 seconds but it does not really time out after 2
seconds. The ejb container compares the actual time take (3 seconds in this case) with the set time (2 seconds) and then throws the TransactionTimeoutException.

Can I catch the TransactionTimeoutException after 2 seconds?
Reid M. Pinchback
Ranch Hand

Joined: Jan 25, 2002
Posts: 775
I doubt you'll ever hit exactly, but how far off you are will depend on the reason for the timeout. If the timeout is due to some kind of blocking I/O (which you aren't supposed to do inside an EJB, but could still be an issue for a container service implementation used by the EJB), then you might not see the transaction failure until the block ends. I've definitely found that to be true for Weblogic.

Transaction timeouts unfortunately don't provide soft realtime-like guarantees, they just do the best they can. Sometimes you are better off moving some code interaction to JMS/MDB or JCA or JMX, depending on the problem, to improve your control over timing.

Reid - SCJP2 (April 2002)
ankush purwar
Ranch Hand

Joined: Sep 02, 2005
Posts: 46
You can't catch Transactiotimeoutexception in weblogic.
It's better for you to catch Remote Exception on client side not in sesion beans .
I agree. Here's the link:
subject: How to catch EJB Transaction Timeout?
It's not a secret anymore!