djb djb - 1 year ago 102
Java Question

JBoss reconnecting on connection time out

I want to reconnect when my connection dies.

The problem I'm getting, I explained here JTA transaction in other thread rolling back

I haven't worked out why it happens, but I've made it impossible now for deadlocks to occur, so I will wait for a week to see if it's fixed.

But I thought my setup should reconnect on failing connection. But instead, the JTA issue kills my connection, and it doesn't come back. Presumably because it's CMT, there is one connection only, which is passed around via

, so the same
is used for everything, so to reconnect, it would have to get a new
from the
, but it doesn't know to do that. I don't know the innards of JBoss and JPA.

This is my setup:

<datasource jndi-name="java:/DS" pool-name="DS" enabled="true" use-java-context="true">

<valid-connection-checker class-name="org.jboss.jca.adapters.jdbc.extensions.mssql.MSSQLValidConnectionChecker"/>
<driver name="sqlserver2008" module="">

What else can I do, to ensure a revived connection on failure?

djb djb
Answer Source

This fixed it:

       <valid-connection-checker class-name="org.jboss.jca.adapters.jdbc.extensions.mssql.MSSQLValidConnectionChecker"/>
Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download