Atomikos Forum |
|
Hi,
We are using atomikos 3.7.1 with Java Springs and hibernate. We are performing a global XA transaction involving a JMS send and JDBC update. However we see that when our application is stopped in the middle of processing an XA transaction, a hanging transaction gets created in the database and is blocking any activity on the dataserver. When we run our application again, we are getting a Heuristic exception. Below is the snapshot of the exception. To Solve this issue, we created a DB script running dbcc command in database to rollback these hanging transactions. Sometimes we see that we need to remove the below files for our application to run. tm.out tm.out.lck tmlog.lck tmlog34.log Any idea how can we run our application without removing these files each time. Exception ---------- WARN [16 Jun 2011 11:48:06:281] atomikos - XAResourceTransaction com.atomikos.spring.jdbc.tm0000400009com.atomikos.spring.jdbc.tm8: no XAResource to commit - the required resource is probably not yet intialized? WARN [16 Jun 2011 11:48:06:281] atomikos - Unexpected error in commit com.atomikos.icatch.HeurHazardException: Heuristic Exception at com.atomikos.datasource.xa.XAResourceTransaction.commit(XAResourceTransaction.java:756) at com.atomikos.icatch.imp.CommitMessage.send(CommitMessage.java:73) at com.atomikos.icatch.imp.PropagationMessage.submit(PropagationMessage.java:111) at com.atomikos.icatch.imp.Propagator$PropagatorThread.run(Propagator.java:87) at com.atomikos.icatch.imp.Propagator.submitPropagationMessage(Propagator.java:66) at com.atomikos.icatch.imp.HeurHazardStateHandler.onTimeout(HeurHazardStateHandler.java:120) at com.atomikos.icatch.imp.CoordinatorImp.alarm(CoordinatorImp.java:1105) at com.atomikos.timing.PooledAlarmTimer.notifyListeners(PooledAlarmTimer.java:112) at com.atomikos.timing.PooledAlarmTimer.run(PooledAlarmTimer.java:99) at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(Unknown Source) at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source) at java.lang.Thread.run(Unknown Source) DBCC command ------------ dbcc complete_xact(xactname, 'rollback')
<bean id="atomikosDataSource" class="com.atomikos.jdbc.AtomikosDataSourceBean" destroy-method="close">
<property name="xaDataSourceClassName"> <value>com.sybase.jdbc3.jdbc.SybXADataSource</value></property> <property name="uniqueResourceName"><value>ase</value></property> <property name="xaProperties"> <props> <prop key="serverName">swdogsdb1d.nam.nsroot.net</prop> <prop key="portNumber">xx</prop> <prop key="databaseName">queuedb</prop> <prop key="user">xx</prop> <prop key="password">xx</prop> </props> </property> <property name="maxPoolSize"><value>20</value></property> <property name="minPoolSize"><value>5</value></property> <property name="poolSize"><value>5</value></property> <property name="borrowConnectionTimeout" value="10000" /> <property name="reapTimeout" value="300"/> <property name="testQuery" value="select 1" /> </bean> <bean id="dataSource" class="com.mchange.v2.c3p0.ComboPooledDataSource"> <property name="driverClass" value="com.sybase.jdbc3.jdbc.SybDriver"/> <property name="jdbcUrl" value="jdbc:sybase:Tds:swdogsdb1d.nam.nsroot.net:xx/xx"/> <property name="user" value="xx"/> <property name="password" value="xx" /> <property name="initialPoolSize" value="1"/> <property name="minPoolSize" value="1"/> <property name="maxPoolSize" value="2"/> </bean> <bean id="jmsConnectionFactory" class="org.springframework.jndi.JndiObjectFactoryBean"> <property name="jndiTemplate" ref="jndiTemplate"/> <property name="jndiName" value="xx.xx.ConnectionFactory"/> </bean> I am using the above context in my application. I have configured both atomikos datasource and connection factory.
Guy,
Do you know how we can clear off the hanging xa transaction in database using atomikos instead of runnin the dbcc comand to clear of the hanging xa transaction. I tried with the init method but the xa transaction still blocks the database when the application is abruptly stopped in the middle of the xa transaction. Is there any configuration than can be made to clear off the xa transaction which got created when the application was stopped. Here is my jta.properties com.atomikos.icatch.service=com.atomikos.icatch.standalone.UserTransactionServiceFactory com.atomikos.icatch.console_file_name = tm.out com.atomikos.icatch.log_base_name = tmlog com.atomikos.icatch.tm_unique_name = com.atomikos.spring.jdbc.tm com.atomikos.icatch.console_log_level = INFO com.atomikos.icatch.default_jta_timeout = 10000000 com.atomikos.icatch.enable_logging = true com.atomikos.icatch.serial_jta_transactions = false com.atomikos.icatch.max_timeout = 30000000 com.atomikos.level = INFO Raghu
You can make xa transactions be 'forgotten' in the JMX console: http://www.atomikos.com/Documentation/JmxInstrumentation
Note: the TM and the DBMS must be running for this to work. |