Jboss - strange exception after automatically reconnecting to XA data source

I am using an XA data source on Jboss 6, using <check-valid-connection-sql> and <background-validation-millis> to automatically reconnect when one of the connections is dead. This works, but the problem is that after "reconnecting" every two minutes I get this strange exception, although my database operations work.

 2011-10-13 12:05:22,516 WARN [com.arjuna.ats.jta] (Periodic Recovery) ARJUNA-16027 Local XARecoveryModule.xaRecovery got XA exception XAException.XAER_RMERR: javax.transaction.xa.XAException: com.microsoft.sqlserver.jdbc.SQLServerException: The connection is closed. at com.microsoft.sqlserver.jdbc.SQLServerXAResource.DTC_XA_Interface(SQLServerXAResource.java:642) [:] at com.microsoft.sqlserver.jdbc.SQLServerXAResource.recover(SQLServerXAResource.java:723) [:] at org.jboss.resource.adapter.jdbc.xa.XAManagedConnection.recover(XAManagedConnection.java:294) [:6.0.0.Final] at com.arjuna.ats.internal.jta.recovery.arjunacore.XARecoveryModule.xaRecovery(XARecoveryModule.java:468) [:6.0.0.Final] at com.arjuna.ats.internal.jta.recovery.arjunacore.XARecoveryModule.resourceInitiatedRecoveryForRecoveryHelpers(XARecoveryModule.java:436) [:6.0.0.Final] at com.arjuna.ats.internal.jta.recovery.arjunacore.XARecoveryModule.periodicWorkSecondPass(XARecoveryModule.java:155) [:6.0.0.Final] at com.arjuna.ats.internal.arjuna.recovery.PeriodicRecovery.doWorkInternal(PeriodicRecovery.java:789) [:6.0.0.Final] at com.arjuna.ats.internal.arjuna.recovery.PeriodicRecovery.run(PeriodicRecovery.java:371) [:6.0.0.Final] 2011-10-13 12:05:22,516 WARN [com.arjuna.ats.jta] (Periodic Recovery) ARJUNA-16027 Local XARecoveryModule.xaRecovery got XA exception XAException.XAER_RMERR: javax.transaction.xa.XAException: com.microsoft.sqlserver.jdbc.SQLServerException: The connection is closed. at com.microsoft.sqlserver.jdbc.SQLServerXAResource.DTC_XA_Interface(SQLServerXAResource.java:642) [:] at com.microsoft.sqlserver.jdbc.SQLServerXAResource.recover(SQLServerXAResource.java:723) [:] at org.jboss.resource.adapter.jdbc.xa.XAManagedConnection.recover(XAManagedConnection.java:294) [:6.0.0.Final] at com.arjuna.ats.internal.jta.recovery.arjunacore.XARecoveryModule.xaRecovery(XARecoveryModule.java:468) [:6.0.0.Final] at com.arjuna.ats.internal.jta.recovery.arjunacore.XARecoveryModule.resourceInitiatedRecoveryForRecoveryHelpers(XARecoveryModule.java:436) [:6.0.0.Final] at com.arjuna.ats.internal.jta.recovery.arjunacore.XARecoveryModule.periodicWorkSecondPass(XARecoveryModule.java:155) [:6.0.0.Final] at com.arjuna.ats.internal.arjuna.recovery.PeriodicRecovery.doWorkInternal(PeriodicRecovery.java:789) [:6.0.0.Final] at com.arjuna.ats.internal.arjuna.recovery.PeriodicRecovery.run(PeriodicRecovery.java:371) [:6.0.0.Final] 

Could this be a driver? (I am using type 4 from Microsoft)

Here is my data source configuration:

 <xa-datasource> <jndi-name>jdbc/MyDataSourceDS</jndi-name> <isSameRM-override-value>false</isSameRM-override-value> <xa-datasource-class>com.microsoft.sqlserver.jdbc.SQLServerXADataSource</xa-datasource-class> <xa-datasource-property name="ServerName">hostname</xa-datasource-property> <xa-datasource-property name="DatabaseName">database</xa-datasource-property> <xa-datasource-property name="SelectMethod">cursor</xa-datasource-property> <xa-datasource-property name="User">user</xa-datasource-property> <xa-datasource-property name="Password">password</xa-datasource-property> <!--pooling parameters--> <min-pool-size>5</min-pool-size> <max-pool-size>100</max-pool-size> <prefill>true</prefill> <blocking-timeout-millis>5000</blocking-timeout-millis> <idle-timeout-minutes>15</idle-timeout-minutes> <new-connection-sql>select 1</new-connection-sql> <check-valid-connection-sql>SELECT 1</check-valid-connection-sql> <background-validation>true</background-validation> <background-validation-millis>10000</background-validation-millis> <!-- corresponding type-mapping in the standardjbosscmp-jdbc.xml (optional) --> <metadata> <type-mapping>MS SQLSERVER2000</type-mapping> </metadata> </xa-datasource> 

Also, I don't see a SELECT 1 query before each query in the logs? I see that my requests are running.

Any help would be appreciated!

+4
source share
1 answer

To get it right - are you running JBoss AS 6 or JBoss EAP 6? But I talked about JBoss EAP 6, which is currently available for download on jboss.org.

I had problems reconnecting the recovery process after the database shutdown, and I'm not sure if this is a problem or some missing configuration. I think this is not a jdbc driver problem. But I could be wrong. If I have some time, I will be interested to explore this. In case I let you know.

However, my workaround is to clear the connection pool for a particular data source. The command in jboss cli will look like this: / Subsystem = data sources / XA -DataSource = [DataSource-name]: flash-all-pool connection ()

What is behind? The Transaction Manager (Narayana) starts the recovery process every 2 minutes. Recovery checks the transaction log on the side of the transaction manager on the application server and on the side of the database. He is looking for dubious transactions that need to be fixed. The recovery process must connect to the database to check for questionable transactions. But when the database is closed, the connection pool * probably * stays with the old connections. A workaround causes the pool to be reset and is again filled with new connections.

+1
source

All Articles