Hi,
I'm seeing an inconsistent problem with the JDBC driver and XA transactions.
I think the problem is derived from the fact I have multiple J2SE applications running on the same server and connecting to the same DB.
I'm using the latest JDBC drivers and I followed the MS instrutions on configuring the MSSQL-Server, including applying the XP-hotfix as my server is windows XP-SP3. My Transaction manager is Atomikos Essential Transactions. My SQL-Server is 2008.
This is part of the logs which atomikos generates:
10-11-23 09:16:05,275 [main] a SessionHandleState with 1 context(s): checking XA context for transaction com.atomikos.icatch.imp.CompositeTransactionImp@635d2874 10-11-23 09:16:05,291 [main] Coordinator 192.168.0.198.tm0000100001 entering state: ACTIVE 10-11-23 09:16:05,291 [main] Coordinator 192.168.0.198.tm0000100001 entered state: ACTIVE 10-11-23 09:16:05,291 [main] addParticipant ( XAResourceTransaction: 3139322E3136382E302E3139382E746D30303030313030303031:3139322E3136382E302E3139382E746D31 ) for transaction 192.168.0.198.tm0000100001 10-11-23 09:16:05,291 [main] XAResourceTransaction: 3139322E3136382E302E3139382E746D30303030313030303031:3139322E3136382E302E3139382E746D31: about to switch to XAResource XAResourceID:1 10-11-23 09:16:05,291 [main] XAResourceTransaction 192.168.0.198.tm0000100001192.168.0.198.tm1: switched to XAResource XAResourceID:1 10-11-23 09:16:05,291 [main] XAResource.start ( 3139322E3136382E302E3139382E746D30303030313030303031:3139322E3136382E302E3139382E746D31 , XAResource.TMNOFLAGS ) on resource java:comp/env/jdbc/dataSource represented by XAResource instance XAResourceID:1 10-11-23 09:16:07,728 [main] XA resource 'java:comp/env/jdbc/dataSource': resume for XID '3139322E3136382E302E3139382E746D30303030313030303031:3139322E3136382E302E3139382E746D31' raised -3: the XA resource detected an internal error javax.transaction.xa.XAException: Function START: failed, status: -3. The error message is: *** SQLJDBC_XA DTC_ERROR Context: FInitializeTransactionManager, state=1, StatusCode:-3 (0xFFFFFFFD) ***. at com.microsoft.sqlserver.jdbc.SQLServerXAResource.DTC_XA_Interface(SQLServerXAResource.java:543) at com.microsoft.sqlserver.jdbc.SQLServerXAResource.start(SQLServerXAResource.java:672) at com.atomikos.datasource.xa.XAResourceTransaction.resume(XAResourceTransaction.java:476) at com.atomikos.datasource.xa.session.BranchEnlistedStateHandler.<init>(BranchEnlistedStateHandler.java:57) at com.atomikos.datasource.xa.session.NotInBranchStateHandler.checkEnlistBeforeUse(NotInBranchStateHandler.java:66) at com.atomikos.datasource.xa.session.TransactionContext.checkEnlistBeforeUse(TransactionContext.java:85) at com.atomikos.datasource.xa.session.SessionHandleState.notifyBeforeUse(SessionHandleState.java:176) at com.atomikos.jdbc.AtomikosConnectionProxy.enlist(AtomikosConnectionProxy.java:197) at com.atomikos.jdbc.AtomikosConnectionProxy.invoke(AtomikosConnectionProxy.java:131) at $Proxy11.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.hql.QueryLoader.list(QueryLoader.java:401) at org.hibernate.hql.ast.QueryTranslatorImpl.list(QueryTranslatorImpl.java:361) at org.hibernate.engine.query.HQLQueryPlan.performList(HQLQueryPlan.java:196) at org.hibernate.impl.SessionImpl.list(SessionImpl.java:1148) at org.hibernate.impl.QueryImpl.list(QueryImpl.java:102) at com.myCompany.dal.hibernate.BaseHibernateDAO.findByProperty(BaseHibernateDAO.java:94) at com.myCompany.dal.DAO.ConfigurationDAO.findByServer(ConfigurationDAO.java:33) at com.myCompany.common.Config.LoadDBConfiuration(Config.java:70) at com.myCompany.common.Config.init(Config.java:56) at com.myCompany.myModule.myModule.main(myModule.java:52) 10-11-23 09:16:07,744 [main] Error enlisting in transaction - connection might be broken? Please check the logs for more information... com.atomikos.datasource.ResourceException: XA resource 'java:comp/env/jdbc/dataSource': resume for XID '3139322E3136382E302E3139382E746D30303030313030303031:3139322E3136382E302E3139382E746D31' raised -3: the XA resource detected an internal error at com.atomikos.datasource.xa.XAResourceTransaction.resume(XAResourceTransaction.java:483) at com.atomikos.datasource.xa.session.BranchEnlistedStateHandler.<init>(BranchEnlistedStateHandler.java:57) at com.atomikos.datasource.xa.session.NotInBranchStateHandler.checkEnlistBeforeUse(NotInBranchStateHandler.java:66) at com.atomikos.datasource.xa.session.TransactionContext.checkEnlistBeforeUse(TransactionContext.java:85) at com.atomikos.datasource.xa.session.SessionHandleState.notifyBeforeUse(SessionHandleState.java:176) at com.atomikos.jdbc.AtomikosConnectionProxy.enlist(AtomikosConnectionProxy.java:197) at com.atomikos.jdbc.AtomikosConnectionProxy.invoke(AtomikosConnectionProxy.java:131) at $Proxy11.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.hql.QueryLoader.list(QueryLoader.java:401) at org.hibernate.hql.ast.QueryTranslatorImpl.list(QueryTranslatorImpl.java:361) at org.hibernate.engine.query.HQLQueryPlan.performList(HQLQueryPlan.java:196) at org.hibernate.impl.SessionImpl.list(SessionImpl.java:1148) at org.hibernate.impl.QueryImpl.list(QueryImpl.java:102) at com.myCompany.dal.hibernate.BaseHibernateDAO.findByProperty(BaseHibernateDAO.java:94) at com.myCompany.dal.DAO.ConfigurationDAO.findByServer(ConfigurationDAO.java:33) at com.myCompany.common.Config.LoadDBConfiuration(Config.java:70) at com.myCompany.common.Config.init(Config.java:56) at com.myCompany.myModule.myModule.main(myModule.java:52) 10-11-23 09:16:07,744 [main] getCompositeTransaction() returning instance with id 192.168.0.198.tm0000100001 10-11-23 09:16:07,744 [main] getCompositeTransaction() returning instance with id 192.168.0.198.tm0000100001 10-11-23 09:16:07,806 [main] getCompositeTransaction() returning instance with id 192.168.0.198.tm0000100001 10-11-23 09:16:07,806 [main] getCompositeTransaction() returning instance with id 192.168.0.198.tm0000100001 10-11-23 09:16:07,822 [main] commit() done (by application) of transaction 192.168.0.198.tm0000100001 10-11-23 09:16:07,822 [main] Coordinator 192.168.0.198.tm0000100001 entering state: PREPARING 10-11-23 09:16:07,822 [main] Coordinator 192.168.0.198.tm0000100001 entered state: PREPARING 10-11-23 09:16:07,822 [main] (1.5) executing task: com.atomikos.icatch.imp.Propagator$PropagatorThread@602b6b 10-11-23 09:16:07,822 [main] ThreadFactory: creating new thread: Atomikos:2 10-11-23 09:16:07,822 [main] (1.5) executing task: com.atomikos.icatch.imp.Propagator$PropagatorThread@3e1bc8 10-11-23 09:16:07,822 [main] ThreadFactory: creating new thread: Atomikos:3 10-11-23 09:16:07,822 [Atomikos:3] XAResource.end ( 3139322E3136382E302E3139382E746D30303030313030303031:3139322E3136382E302E3139382E746D31 , XAResource.TMSUCCESS ) on resource java:comp/env/jdbc/dataSource represented by XAResource instance XAResourceID:1 10-11-23 09:16:09,900 [Atomikos:3] XA resource 'java:comp/env/jdbc/dataSource': end for XID '3139322E3136382E302E3139382E746D30303030313030303031:3139322E3136382E302E3139382E746D31' raised -7: the XA resource has become unavailable javax.transaction.xa.XAException: Function END: failed, status: -7. The error message is: *** SQLJDBC_XA DTC_ERROR Context: xa_end, state=1, StatusCode:-7 (0xFFFFFFF9) ***. at com.microsoft.sqlserver.jdbc.SQLServerXAResource.DTC_XA_Interface(SQLServerXAResource.java:543) at com.microsoft.sqlserver.jdbc.SQLServerXAResource.end(SQLServerXAResource.java:685) at com.atomikos.datasource.xa.XAResourceTransaction.suspend(XAResourceTransaction.java:440) at com.atomikos.datasource.xa.XAResourceTransaction.prepare(XAResourceTransaction.java:591) at com.atomikos.icatch.imp.PrepareMessage.send(PrepareMessage.java:61) at com.atomikos.icatch.imp.PropagationMessage.submit(PropagationMessage.java:111) at com.atomikos.icatch.imp.Propagator$PropagatorThread.run(Propagator.java:87) 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) 10-11-23 09:16:09,900 [main] Coordinator 192.168.0.198.tm0000100001 entering state: ABORTING 10-11-23 09:16:09,900 [main] Coordinator 192.168.0.198.tm0000100001 entered state: ABORTING 10-11-23 09:16:09,900 [main] (1.5) executing task: com.atomikos.icatch.imp.Propagator$PropagatorThread@13b9fae 10-11-23 09:16:09,900 [main] Coordinator 192.168.0.198.tm0000100001 entering state: TERMINATED 10-11-23 09:16:09,900 [main] Coordinator 192.168.0.198.tm0000100001 : stopping timer... 10-11-23 09:16:09,900 [main] Coordinator 192.168.0.198.tm0000100001 : disposing statehandler TERMINATED... 10-11-23 09:16:09,900 [main] Coordinator 192.168.0.198.tm0000100001 : disposed.
If you have any questions please don't hesitate to ask.
I'd appreciate any help granted,
Ittai