You are viewing a plain text version of this content. The canonical link for it is here.
Posted to derby-dev@db.apache.org by Prashant Bhagat <Pr...@Sun.COM> on 2006/11/28 05:33:16 UTC

ERROR 40XL2: A lock could not be obtained within the time requested.

Hi,

I'm using the Derby database bundled with Sun Java System Application
Server 9. My application writes to the database using XA and well as
non-XA connections. For XA as well as non-XA , the application directly
instantiates the DataSource and gets the connection. The application
manages its own transactions using the TransactionManager, that is, it
does its own enlist/delist (for XA), etc.

 

I run into this error ERROR 40XL2: A lock could not be obtained within
the time requested, for the case outlined below.

 

There are two transactions T1 (XA) and T2 (Non-XA). They have two common
tables that they update.

 

1.	Start T1 and write to the database
2.	Abort appserver (note: T1 is still in progress, that is, commit
has not been called)
3.	Start appserver
4.	Do T2 - exceptions (ERROR 40XL2: A lock could not be obtained
within the time requested.)

 

Doing T1 again does not result in any exceptions. 

 

One more thing: When the appserver is started in 3, the application does
not register an XAResource with the TransactionManager. So no XA
recovery takes place. That should not matter for this case since the
appserver was aborted before the Transaction is in the prepared state.

 

Thanks

Prashant