none
System.Transactions.TransactionException: Unable to obtain the transaction identifier using TransactionScope, Sql05, DTC and MQ RRS feed

  • Question

  • I am trying to have a two-phase commit between Websphere MQ and Sql Server 2005 through MSDTC but I get this exception when the TransactionScope is going out of scope:

     

    ************** Exception Text **************

    System.Transactions.TransactionException: Unable to obtain the transaction identifier.

    at System.Transactions.Oletx.RealOletxTransaction.get_Identifier()

    at System.Transactions.Oletx.OletxTransaction.get_Identifier()

    at System.Transactions.TransactionStatePromotedBase.get_Identifier(InternalTransaction tx)

    at System.Transactions.TransactionInformation.get_DistributedIdentifier()

    at SAC.MQ.DTC.Test.Form1.TransactionManager_DistributedTransactionStarted(Object sender, TransactionEventArgs e) in C:\VSS\EntDataSvcs\Messaging\SAC.MQ.DTC.Test\Form1.cs:line 71

    at System.Transactions.TransactionManager.FireDistributedTransactionStarted(Transaction transaction)

    at System.Transactions.TransactionInterop.GetTransactionFromDtcTransaction(IDtcTransaction transactionNative)

    at System.EnterpriseServices.ContextUtil.get_SystemTransaction()

    at System.Transactions.Transaction.JitSafeGetContextTransaction(ContextData contextData)

    at System.Transactions.Transaction.FastGetTransaction(TransactionScope currentScope, ContextData contextData, Transaction& contextTransaction)

    at System.Transactions.TransactionScope.Dispose()

     

     

     

    It seems that both resource managers (MQ and MSSQL) write and then rollback their respective data.

     

    Thanks

    Tuesday, May 6, 2008 8:46 PM

All replies

  •  

    That exception is a red herring. It blew up in the

    void TransactionManager_DistributedTransactionStarted(object sender, TransactionEventArgs e)

     

    event.

     

    I put a try catch around it and it went away.

    It now blows up here:

     

    System.Transactions.TransactionException: The transaction has already been implicitly or explicitly committed or aborted. ---> System.Runtime.InteropServices.COMException (0x8004D00E): The transaction has already been implicitly or explicitly committed or aborted (Exception from HRESULT: 0x8004D00E)
       at System.Transactions.Oletx.ITransactionShim.Export(UInt32 whereaboutsSize, Byte[] whereabouts, Int32& cookieIndex, UInt32& cookieSize, CoTaskMemHandle& cookieBuffer)
       at System.Transactions.TransactionInterop.GetExportCookie(Transaction transaction, Byte[] whereabouts)
       --- End of inner exception stack trace ---
       at System.Transactions.Oletx.OletxTransactionManager.ProxyException(COMException comException)
       at System.Transactions.TransactionInterop.GetExportCookie(Transaction transaction, Byte[] whereabouts)
       at System.Data.SqlClient.SqlInternalConnection.EnlistNonNull(Transaction tx)
       at System.Data.SqlClient.SqlInternalConnection.Enlist(Transaction tx)
       at System.Data.SqlClient.SqlInternalConnectionTds.Activate(Transaction transaction)
       at System.Data.ProviderBase.DbConnectionInternal.ActivateConnection(Transaction transaction)
       at System.Data.ProviderBase.DbConnectionPool.GetConnection(DbConnection owningObject)
       at System.Data.ProviderBase.DbConnectionFactory.GetConnection(DbConnection owningConnection)
       at System.Data.ProviderBase.DbConnectionClosed.OpenConnection(DbConnection outerConnection, DbConnectionFactory connectionFactory)
       at System.Data.SqlClient.SqlConnection.Open()
    Wednesday, May 7, 2008 2:23 PM