Exception Description: DatabaseAccessor not connected. [message #759590] |
Tue, 29 November 2011 04:51  |
Eclipse User |
|
|
|
I have the sequence of using entitymanager as below
1) em.getTransactin().begin()
2) Query q = em.createNamedQuery, which will call a stored procedure and the stored procedure will return cursor.
3) CursoredStream c = (CursoredStream) q.getSingleResult();
4) Loop thru the CursoredStream
5) Close the CursoredStream
After 33 times execution of the above loop failed, encountered the exception "Exception Description: DatabaseAccessor not connected".
Recap the 32st (success) & the 33rd (fail) log below.
Seems that EclipseLink have 32 connections in connection pool by default.
When execute a query which return a cursoredStream, it will close the connection.
When all connections in the pool is disconnected, the 33rd run will be failed due to DatabaseAccessor not connected.
[EL Finer]: 2011-11-29 17:34:45.114--ServerSession(1208495415)--client acquired: 72420802
[EL Finer]: 2011-11-29 17:34:45.115--ClientSession(72420802)--acquire unit of work: 1700675012
[EL Finer]: 2011-11-29 17:34:45.116--UnitOfWork(1700675012)--begin unit of work flush
[EL Finer]: 2011-11-29 17:34:45.116--UnitOfWork(1700675012)--end unit of work flush
[EL Finest]: 2011-11-29 17:34:45.116--UnitOfWork(1700675012)--Execute query DataModifyQuery()
[EL Finest]: 2011-11-29 17:34:45.117--ServerSession(1208495415)--Connection(418787413)--Connection acquired from connection pool [default].
[EL Finer]: 2011-11-29 17:34:45.117--ClientSession(72420802)--Connection(418787413)--begin transaction
[EL Fine]: 2011-11-29 17:34:45.117--ClientSession(72420802)--Connection(418787413)--CALL db_set_r_sett_tx()
[EL Finer]: 2011-11-29 17:34:45.12--UnitOfWork(1700675012)--begin unit of work flush
[EL Finer]: 2011-11-29 17:34:45.12--UnitOfWork(1700675012)--end unit of work flush
[EL Finest]: 2011-11-29 17:34:45.12--UnitOfWork(1700675012)--Execute query ReadAllQuery(name="db_sett_eh_open_cr_cur" referenceClass=SysEventTT )
[EL Fine]: 2011-11-29 17:34:45.121--ClientSession(72420802)--Connection(418787413)--CALL db_sett_eh_open_cr_cur()
[EL Finest]: 2011-11-29 17:34:45.124--ServerSession(1208495415)--Connection(418787413)--Connection released to connection pool [default].
[EL Finer]: 2011-11-29 17:34:45.127--UnitOfWork(1700675012)--release unit of work
[EL Finer]: 2011-11-29 17:34:45.127--ClientSession(72420802)--Connection(418787413)--rollback transaction
[EL Finest]: 2011-11-29 17:34:45.127--ServerSession(1208495415)--Connection(418787413)--Connection released to connection pool [default].
[EL Config]: 2011-11-29 17:34:45.127--ServerSession(1208495415)--Connection(418787413)--disconnect
[EL Finer]: 2011-11-29 17:34:45.128--ClientSession(72420802)--client released
[EL Finer]: 2011-11-29 17:34:46.133--ServerSession(1208495415)--client acquired: 237585114
[EL Finer]: 2011-11-29 17:34:46.133--ClientSession(237585114)--acquire unit of work: 920911225
[EL Finer]: 2011-11-29 17:34:46.135--UnitOfWork(920911225)--begin unit of work flush
[EL Finer]: 2011-11-29 17:34:46.135--UnitOfWork(920911225)--end unit of work flush
[EL Finest]: 2011-11-29 17:34:46.135--UnitOfWork(920911225)--Execute query DataModifyQuery()
[EL Finest]: 2011-11-29 17:34:46.136--ServerSession(1208495415)--Connection(127616840)--Connection acquired from connection pool [default].
[EL Finer]: 2011-11-29 17:34:46.136--ClientSession(237585114)--Connection(127616840)--begin transaction
[EL Warning]: 2011-11-29 17:34:46.14--ClientSession(237585114)--Local Exception Stack:
Exception [EclipseLink-4005] (Eclipse Persistence Services - 2.3.0.v20110604-r9504): org.eclipse.persistence.exceptions.DatabaseException
Exception Description: DatabaseAccessor not connected.
|
|
|
|
|
Re: Exception Description: DatabaseAccessor not connected. [message #760300 is a reply to message #759590] |
Thu, 01 December 2011 14:48  |
Eclipse User |
|
|
|
Hello,
The exception posted shows that EclipseLink is trying to release the connection back to the connection pool when the cursor is done - after the last row has been obtained or an exception has occurred. It should have nothing to do with the number of connections in the pool, since it will reuse the same connection until the cursor is closed. The connection needs to remain open as long as the cursor does. So this error should occur depending on the page/read size of the cursor and the amount of data within the cursor or if there is another exception occuring - such as if EclipseLink is trying to obtain a connection.
Are you using JTA? If so, you should not be using em.getTransaction.begin() to demarcate the transaction, so it could be there is a configuration problem.
Things to check:
1) That you have configured your persistence unit connection pool and transaction-type correctly. You didn't mention the server you are on, but there are examples for various servers at:
http://wiki.eclipse.org/EclipseLink/Examples/JPA
2) that you are checking for the end of the CursoredStream as described here:
http://wiki.eclipse.org/Using_Advanced_Query_API_(ELUG)#How_to_Handle_Java_Streams
3) That this reproduces with the latest EclipseLink nightly build or release (2.3.1). There was a scrollablecursor bug fixed that seems similar, but it will make it easier to diagnose if this turns out to be a bug. You could also try to use a scrollableCursor instead to see if it works around your issue.
Best Regards,
Chris
|
|
|
Re: Exception Description: DatabaseAccessor not connected. [message #760303 is a reply to message #759590] |
Thu, 01 December 2011 14:48  |
Eclipse User |
|
|
|
Hello,
The exception posted shows that EclipseLink is trying to release the connection back to the connection pool when the cursor is done - after the last row has been obtained or an exception has occurred. It should have nothing to do with the number of connections in the pool, since it will reuse the same connection until the cursor is closed. The connection needs to remain open as long as the cursor does. So this error should occur depending on the page/read size of the cursor and the amount of data within the cursor or if there is another exception occuring - such as if EclipseLink is trying to obtain a connection.
Are you using JTA? If so, you should not be using em.getTransaction.begin() to demarcate the transaction, so it could be there is a configuration problem.
Things to check:
1) That you have configured your persistence unit connection pool and transaction-type correctly. You didn't mention the server you are on, but there are examples for various servers at:
http://wiki.eclipse.org/EclipseLink/Examples/JPA
2) that you are checking for the end of the CursoredStream as described here:
http://wiki.eclipse.org/Using_Advanced_Query_API_(ELUG)#How_to_Handle_Java_Streams
3) That this reproduces with the latest EclipseLink nightly build or release (2.3.1). There was a scrollablecursor bug fixed that seems similar, but it will make it easier to diagnose if this turns out to be a bug. You could also try to use a scrollableCursor instead to see if it works around your issue.
Best Regards,
Chris
|
|
|
Powered by
FUDForum. Page generated in 0.04985 seconds