Atomikos Forum |
|
I got a lot of exceptions like these in my project.
I am using Atomikos TransactionEssentials 3.5.3, Spring-2.5.3, Hibernate-3.3.1 and mysql database. Exception: com.atomikos.datasource.ResourceException: XA resource 'XA-CORE-TESTPROJECT-DATASOURCE': resume for XID '31302E3235312E3230322E3136352E746D32353231313030313130:31302E3235312E3230322E3136352E746D313030303032' raised -7: the XA resource has become unavailable at com.atomikos.datasource.xa.XAResourceTransaction.resume(XAResourceTransaction.java:653) at com.atomikos.datasource.xa.session.BranchEnlistedStateHandler.<init>(BranchEnlistedStateHandler.java:32) at com.atomikos.datasource.xa.session.NotInBranchStateHandler.checkEnlistBeforeUse(NotInBranchStateHandler.java:41) at com.atomikos.datasource.xa.session.TransactionContext.checkEnlistBeforeUse(TransactionContext.java:60) at com.atomikos.datasource.xa.session.SessionHandleState.notifyBeforeUse(SessionHandleState.java:151) at com.atomikos.jdbc.AtomikosConnectionProxy.enlist(AtomikosConnectionProxy.java:165) at com.atomikos.jdbc.AtomikosConnectionProxy.invoke(AtomikosConnectionProxy.java:105) at $Proxy1.prepareStatement(Unknown Source) at org.hibernate.jdbc.AbstractBatcher.getPreparedStatement(AbstractBatcher.java:534) at org.hibernate.jdbc.AbstractBatcher.getPreparedStatement(AbstractBatcher.java:452) at org.hibernate.jdbc.AbstractBatcher.prepareQueryStatement(AbstractBatcher.java:161) at org.hibernate.loader.Loader.prepareQueryStatement(Loader.java:1573) at org.hibernate.loader.Loader.doQuery(Loader.java:696) at org.hibernate.loader.Loader.doQueryAndInitializeNonLazyCollections(Loader.java:259) at org.hibernate.loader.Loader.doList(Loader.java:2228) at org.hibernate.loader.Loader.listIgnoreQueryCache(Loader.java:2125) at org.hibernate.loader.Loader.list(Loader.java:2120) at org.hibernate.loader.criteria.CriteriaLoader.list(CriteriaLoader.java:118) at org.hibernate.impl.SessionImpl.list(SessionImpl.java:1596) at org.hibernate.impl.CriteriaImpl.list(CriteriaImpl.java:306) at org.springframework.orm.hibernate3.HibernateTemplate$36.doInHibernate(HibernateTemplate.java:1061) at org.springframework.orm.hibernate3.HibernateTemplate.doExecute(HibernateTemplate.java:419) at org.springframework.orm.hibernate3.HibernateTemplate.executeWithNativeSession(HibernateTemplate.java:374) at org.springframework.orm.hibernate3.HibernateTemplate.findByCriteria(HibernateTemplate.java:1051) at org.springframework.orm.hibernate3.HibernateTemplate.findByCriteria(HibernateTemplate.java:1044)
Nested exception is:
com.mysql.jdbc.jdbc2.optional.MysqlXAException: XAER_RMFAIL: The command cannot be executed when global transaction is in the ACTIVE state at com.mysql.jdbc.jdbc2.optional.MysqlXAConnection.mapXAExceptionFromSQLException(MysqlXAConnection.java:602) at com.mysql.jdbc.jdbc2.optional.MysqlXAConnection.dispatchCommand(MysqlXAConnection.java:585) at com.mysql.jdbc.jdbc2.optional.MysqlXAConnection.start(MysqlXAConnection.java:525) at com.atomikos.datasource.xa.XAResourceTransaction.resume(XAResourceTransaction.java:643) at com.atomikos.datasource.xa.session.BranchEnlistedStateHandler.<init>(BranchEnlistedStateHandler.java:32) at com.atomikos.datasource.xa.session.NotInBranchStateHandler.checkEnlistBeforeUse(NotInBranchStateHandler.java:41) at com.atomikos.datasource.xa.session.TransactionContext.checkEnlistBeforeUse(TransactionContext.java:60) at com.atomikos.datasource.xa.session.SessionHandleState.notifyBeforeUse(SessionHandleState.java:151) at com.atomikos.jdbc.AtomikosConnectionProxy.enlist(AtomikosConnectionProxy.java:165) at com.atomikos.jdbc.AtomikosConnectionProxy.invoke(AtomikosConnectionProxy.java:105) at $Proxy1.prepareStatement(Unknown Source) at org.hibernate.jdbc.AbstractBatcher.getPreparedStatement(AbstractBatcher.java:534) at org.hibernate.jdbc.AbstractBatcher.getPreparedStatement(AbstractBatcher.java:452) at org.hibernate.jdbc.AbstractBatcher.prepareQueryStatement(AbstractBatcher.java:161) at org.hibernate.loader.Loader.prepareQueryStatement(Loader.java:1573) at org.hibernate.loader.Loader.doQuery(Loader.java:696) at org.hibernate.loader.Loader.doQueryAndInitializeNonLazyCollections(Loader.java:259) at org.hibernate.loader.Loader.doList(Loader.java:2228) at org.hibernate.loader.Loader.listIgnoreQueryCache(Loader.java:2125) at org.hibernate.loader.Loader.list(Loader.java:2120) at org.hibernate.loader.criteria.CriteriaLoader.list(CriteriaLoader.java:118) at org.hibernate.impl.SessionImpl.list(SessionImpl.java:1596) at org.hibernate.impl.CriteriaImpl.list(CriteriaImpl.java:306) at org.springframework.orm.hibernate3.HibernateTemplate$36.doInHibernate(HibernateTemplate.java:1061) at org.springframework.orm.hibernate3.HibernateTemplate.doExecute(HibernateTemplate.java:419) at org.springframework.orm.hibernate3.HibernateTemplate.executeWithNativeSession(HibernateTemplate.java:374) at org.springframework.orm.hibernate3.HibernateTemplate.findByCriteria(HibernateTemplate.java:1051) at org.springframework.orm.hibernate3.Hibernate
Tm.out log snippet:
09-03-30 02:12:01,344 [DefaultQuartzScheduler_Worker-9] atomikos connection proxy for com.mysql.jdbc.jdbc2.optional.ConnectionWrapper@db81f3: toString returning com.mysql.jdbc.jdbc2.optional.ConnectionWrapper@db81f3 09-03-30 02:12:01,344 [DefaultQuartzScheduler_Worker-9] an AtomikosXAPooledConnection with a SessionHandleState with 1 context(s): returning proxy com.mysql.jdbc.jdbc2.optional.ConnectionWrapper@db81f3 09-03-30 02:12:01,344 [DefaultQuartzScheduler_Worker-9] atomikos connection pool 'XA-CORE-TESTPROJECT-DATASOURCE': got connection from pool, new size: 4/6 09-03-30 02:12:01,344 [DefaultQuartzScheduler_Worker-9] getCompositeTransaction() returning instance with id 10.251.202.165.tm2521100110 09-03-30 02:12:01,344 [DefaultQuartzScheduler_Worker-9] atomikos connection proxy for com.mysql.jdbc.jdbc2.optional.ConnectionWrapper@db81f3: calling toString... 09-03-30 02:12:01,344 [DefaultQuartzScheduler_Worker-9] atomikos connection proxy for com.mysql.jdbc.jdbc2.optional.ConnectionWrapper@db81f3: toString returning com.mysql.jdbc.jdbc2.optional.ConnectionWrapper@db81f3 09-03-30 02:12:01,344 [DefaultQuartzScheduler_Worker-9] AtomikosDataSoureBean 'XA-CORE-TESTPROJECT-DATASOURCE': returning com.mysql.jdbc.jdbc2.optional.ConnectionWrapper@db81f3 09-03-30 02:12:01,344 [DefaultQuartzScheduler_Worker-9] getCompositeTransaction() returning instance with id 10.251.202.165.tm2521100110 09-03-30 02:12:01,344 [DefaultQuartzScheduler_Worker-9] atomikos connection proxy for com.mysql.jdbc.jdbc2.optional.ConnectionWrapper@db81f3: notifyBeforeUse a SessionHandleState with 1 context(s) 09-03-30 02:12:01,344 [DefaultQuartzScheduler_Worker-9] getCompositeTransaction() returning instance with id 10.251.202.165.tm2521100110 09-03-30 02:12:01,344 [DefaultQuartzScheduler_Worker-9] a SessionHandleState with 1 context(s): checking XA context for transaction com.atomikos.icatch.imp.CompositeTransactionImp@1e4b5c9 09-03-30 02:12:01,345 [DefaultQuartzScheduler_Worker-9] Coordinator 10.251.202.165.tm2521100110 entering state: ACTIVE 09-03-30 02:12:01,345 [DefaultQuartzScheduler_Worker-9] Coordinator 10.251.202.165.tm2521100110 entered state: ACTIVE
09-03-30 02:12:01,345 [DefaultQuartzScheduler_Worker-9] addParticipant ( XAResourceTransaction: 31302E3235312E3230322E3136352E746D32353231313030313130:31302E3235312E3230322E3136352E746D313030303032 ) for transaction 10.251.202.165.tm2521100110
09-03-30 02:12:01,345 [DefaultQuartzScheduler_Worker-9] XAResourceTransaction: 31302E3235312E3230322E3136352E746D32353231313030313130:31302E3235312E3230322E3136352E746D313030303032: about to switch to XAResource com.mysql.jdbc.jdbc2.optional.MysqlXAConnection@1677979 09-03-30 02:12:01,345 [DefaultQuartzScheduler_Worker-9] XAResourceTransaction 10.251.202.165.tm252110011010.251.202.165.tm100002: switched to XAResource com.mysql.jdbc.jdbc2.optional.MysqlXAConnection@1677979 09-03-30 02:12:01,657 [DefaultQuartzScheduler_Worker-9] XA resource 'XA-CORE-TESTPROJECT-DATASOURCE': resume for XID '31302E3235312E3230322E3136352E746D32353231313030313130:31302E3235312E3230322E3136352E746D313030303032' raised -7: the XA resource has become unavailable 09-03-30 02:12:01,657 [DefaultQuartzScheduler_Worker-9] Error enlisting in transaction - connection might be broken? Please check the logs for more information... 09-03-30 02:12:01,657 [DefaultQuartzScheduler_Worker-9] getCompositeTransaction() returning instance with id 10.251.202.165.tm2521100110 09-03-30 02:12:01,657 [DefaultQuartzScheduler_Worker-9] getCompositeTransaction() returning instance with id 10.251.202.165.tm2521100110 09-03-30 02:12:01,658 [DefaultQuartzScheduler_Worker-9] getCompositeTransaction() returning instance with id 10.251.202.165.tm2521100110 09-03-30 02:12:01,658 [DefaultQuartzScheduler_Worker-9] getCompositeTransaction() returning instance with id 10.251.202.165.tm2521100110 09-03-30 02:12:01,658 [DefaultQuartzScheduler_Worker-9] getCompositeTransaction() returning instance with id 10.251.202.165.tm2521100110 09-03-30 02:12:01,658 [DefaultQuartzScheduler_Worker-9] Coordinator 10.251.202.165.tm2521100110 entering state: ACTIVE 09-03-30 02:12:01,658 [DefaultQuartzScheduler_Worker-9] Coordinator 10.251.202.165.tm2521100110 entered state: ACTIVE 09-03-30 02:12:01,658 [DefaultQuartzScheduler_Worker-9] setRollbackOnly() called for transaction 10.251.202.165.tm2521100110 09-03-30 02:12:01,658 [DefaultQuartzScheduler_Worker-9] atomikos connection proxy for com.mysql.jdbc.jdbc2.optional.ConnectionWrapper@db81f3: isClosed()... 09-03-30 02:12:01,658 [DefaultQuartzScheduler_Worker-9] atomikos connection proxy for com.mysql.jdbc.jdbc2.optional.ConnectionWrapper@db81f3: isClosed() returning false 09-03-30 02:12:01,658 [DefaultQuartzScheduler_Worker-9] getCompositeTransaction() returning instance with id 10.251.202.165.tm2521100110 09-03-30 02:12:01,658 [DefaultQuartzScheduler_Worker-9] atomikos connection proxy for com.mysql.jdbc.jdbc2.optional.ConnectionWrapper@db81f3: calling clearWarnings...
Can someone please help.
I found this from Mysql site regarding this issue. But didn't help me to solve this issue. "Note that if an XA transaction is in the ACTIVE state, you cannot issue any statements that cause an implicit commit. That would violate the XA contract because you could not roll back the XA transaction. You will receive the following error if you try to execute such a statement: ERROR 1399 (XAE07): XAER_RMFAIL: The command cannot be executed when global transaction is in the ACTIVE state " |