Atomikos Forum

Connection recovery

I wonder if it is somehow possible to get automatic connection recovery once a database has restarted?

I'm using Atomikos Transaction Essentials 3.5.5. with Spring 2.5 and PostgreSQL database.

Now I get exceptions stacks like these:

09:50:49,791 pool-1-thread-3 INFO  org.hibernate.event.def.DefaultLoadEventListener  - Error performing load command
org.hibernate.exception.JDBCConnectionException: could not load an entity: [com.mydomain.MyObject#14950]
Caused by: org.postgresql.util.PSQLException: An I/O error occured while sending to the backend.
Caused by: java.net.SocketException: Broken pipe
java.lang.IllegalStateException: This method needs a transaction for the calling thread and none exists. Possible causes: either you didn't start a transaction,
it rolledback due to timeout, or it was committed already.
ACTIONS: You can try one of the following:
1. Make sure you started a transaction for the thread.
2. Make sure you didn't terminate it yet.
3. Increase the transaction timeout to avoid automatic rollback of long transactions;
  check http://www.atomikos.org/forums/viewtopic.php?t=1259 for how to do this.

Adriaan
Adriaan Wisse Send private email
Monday, August 31, 2009
 
 
If you do getConnection() on the datasource then you should get a new one transparently.

HTH
Guy Pardon Send private email
Monday, August 31, 2009
 
 
That's not as easy as it sounds because we are using @Transactional annotations.

But I already found another solution: configure the testQuery on the com.atomikos.jdbc.AtomikosDataSourceBean

When using spring it will be like this:

<bean id="xaPoolDataSource" class="com.atomikos.jdbc.AtomikosDataSourceBean"
        init-method="init" destroy-method="close">
    <property name="xaDataSource" ref="postgresqlXADataSource" />
    <property name="uniqueResourceName" value="atds-1"/>
    <property name="testQuery" value="SELECT 1"/>
</bean>
Adriaan Wisse Send private email
Tuesday, September 22, 2009
 
 
Guy Pardon Send private email
Tuesday, September 22, 2009
 
 

This topic is archived. No further replies will be accepted.

Other recent topics Other recent topics