|
RSS Feed - WebSphere MQ Support
|
RSS Feed - Message Broker Support
|
 |
|
Can't enlist in COM+ transaction (.NET) |
« View previous topic :: View next topic » |
Author |
Message
|
dhanjel |
Posted: Thu Jul 10, 2008 10:16 pm Post subject: Can't enlist in COM+ transaction (.NET) |
|
|
Newbie
Joined: 10 Jul 2008 Posts: 3
|
Hi guys, I have some serious problems with com+ enlistment.
I have a windows service with a com+ defined class (inherits ServicedComponent, has [Transaction(TransactionOption.RequiresNew)] and [AutoComplete(true)] on the method.)
The problem is that the mq series part never rolls back in case of any errors, the other transactions works perfectly fine.
When it comes to the mq connection, I have set up the enviroment to use server-bindings (a requirement for using transactions)
Code: |
MQEnvironment.properties[MQC.TRANSPORT_PROPERTY] = MQC.TRANSPORT_MQSERIES_BINDINGS; |
and the connection / send looks like this (stripped):
Code: |
queueManager = new MQQueueManager(queueManagerName, channel, host);
queueManager.Connect();
...
sendOptions = new MQPutMessageOptions();
sendOptions.Options += MQC.MQRO_NEW_MSG_ID + MQC.MQRO_COPY_MSG_ID_TO_CORREL_ID;
sendOptions.Options += MQC.MQGMO_SYNCPOINT;
...
queue = queueManager.AccessQueue(queueName, MQC.MQOO_OUTPUT + MQC.MQOO_FAIL_IF_QUIESCING);
queue.Put(msg, sendOptions);
queue.Close(); |
Do I have to do anything in perticular in the transaction-based method for this to work?
Scaled down, it looks lite this:
Code: |
[AutoComplete(true)]
function void DoWork()
{
try
{
send_message_on_mqqueue();
do_some_db_work();
ContextUtil.SetComplete();
}
catch (Exception)
{
ContextUtil.SetAbort();
}
} |
Any help, thoughts or suggestions are appreciated! |
|
Back to top |
|
 |
David.Partridge |
Posted: Fri Jul 11, 2008 12:48 am Post subject: |
|
|
 Master
Joined: 28 Jun 2001 Posts: 249
|
Where is your queueManager.begin() to tell the QM that you want to take part in a global unit of work?
Also, at what point are you disconnecting from the qmgr?
"If an application disconnects (MQDISC) while a global unit of work is still active, the unit of work is committed. If, however, the application terminates without disconnecting, the unit of work is rolled back as the application is deemed to have terminated abnormally."
HTH _________________ Cheers,
David C. Partridge |
|
Back to top |
|
 |
dhanjel |
Posted: Fri Jul 11, 2008 2:31 am Post subject: |
|
|
Newbie
Joined: 10 Jul 2008 Posts: 3
|
Ok, I've missed the part that begin has to be used with com+ transactions as well, with semi-pseudo-code, it looks like this now:
Code: |
[AutoComplete(true)]
function void DoWork()
{
connect_mq();
mq.begin();
try
{
send_message_on_mqqueue();
do_some_db_work();
ContextUtil.SetComplete();
}
catch (Exception)
{
ContextUtil.SetAbort();
}
disconnect_mq();
}
|
But now it throws an exception that it can't enlist in the transaction (but at least it is trying now)
The error thrown is MQRC_UOW_ENLISTMENT_ERROR, any suggestions? |
|
Back to top |
|
 |
David.Partridge |
Posted: Fri Jul 11, 2008 5:36 am Post subject: |
|
|
 Master
Joined: 28 Jun 2001 Posts: 249
|
|
Back to top |
|
 |
David.Partridge |
Posted: Fri Jul 11, 2008 5:37 am Post subject: |
|
|
 Master
Joined: 28 Jun 2001 Posts: 249
|
|
Back to top |
|
 |
David.Partridge |
Posted: Fri Jul 11, 2008 5:50 am Post subject: |
|
|
 Master
Joined: 28 Jun 2001 Posts: 249
|
From the MQ 6.0.1 release notes:
MQRC_UOW_ENLISTMENT_ERROR (2354) on Windows 2003 Server
This problem occurs on Windows 2003 only.
XA transactions are disabled by default. WebSphere MQ uses the
Microsoft Distributed Transaction Coordinator using the XA
mechanism. You need to enable XA transactions to participate in
transactions.
Problem: If you are using a transactional .NET component, you
might see errors when you issue a Get method on an MQQueue
object to get a message within a COM+ transaction.
You will not see any additional information associated with the
failure and the Microsoft Distributed Transaction Coordinator
(MSDTC) in the event viewer.
Solution: To enable XA transactions, change a setting in
Component Services for the machine experiencing the failure:
Component Services -> "Computer Name" -> Right click ->
Properties -> MSDTC tab and check the 'XA Transactions' check
box
If XA Transactions are already enabled, check if you have an
XADLL tag (see the following problem for more details).
MQRC_UOW_ENLISTMENT_ERROR (2354) on Windows 2003
This problem occurs on Windows 2003 only.
In order to participate in an XA transaction, your XA DLL
needs to be registered to the system. WebSphere MQ will try to
do this during install.
Problem: You have XA transactions enabled, but you still see a
2354 reason code when you try to get or put a message in a COM+
transaction or using a .NET application that inherits from
ServicedComponent.
On Windows XP, if the transaction does time out, the next
WebSphere MQ call returns reason code 2354
(MQRD_UOW_ENLISTMENT_ERROR) as expected and documented.
On Windows 2003, however, on the FIRST instance of MQPUT,
WebSphere MQ returns reason code 2354
(MQRD_UOW_ENLISTMENT_ERROR).
Solution: Add the WebSphere MQ XA resource manager DLL to the
list of DLLs in the XADLL key of the registry:
HKLM\SOFTWARE\Microsoft\MSDTC\XADLL
The DLL name is amqmtsxatm.dll. It has a value type of REG_SZ.
The value of the installed location of the DLL is
mqmtop\bin\amqmtsxatm.dll.
MQRC_UOW_ENLISTMENT_ERROR (2354) on Windows 2003
This problem occurs on Windows 2003 and Windows XP only.
If the COM+ transaction also contains resources that are
remote, you might need to authorize Microsoft Distributed
Transaction Coordinator to talk on the network.
Problem: Symptoms include reason code
MQRC_UOW_ENLISTMENT_ERROR (2354) or reason code 2195 with
0XC0C11007 logged in BizTalk event log message 264.
You require additional definitions to enable COM+ (Microsoft
Transaction Server) transactions with the MSDTC coordinating
with other machines.
Solution: You need to follow the solution instructions for the
two problems described above. That is, enable XA transactions,
and register a resource manager DLL.
After you have completed these two tasks, you might still
experience problems. These are 2195 reason codes and
MQRC_UOW_ENLISTMENT_ERROR (2354) reason codes if the DTC needs
to be involved in a transaction that requires access to the
network. If this is the case, you also need to enable MSDTC
network access
Go to the Component Services GUI (in Administrative Tools), and
go to My Computer and right click -> Properties -> MSDTC. Click
the "Security Configuration" button, and enable the ability for
the MSDTC to talk on the network. _________________ Cheers,
David C. Partridge |
|
Back to top |
|
 |
dhanjel |
Posted: Sun Aug 10, 2008 10:32 pm Post subject: |
|
|
Newbie
Joined: 10 Jul 2008 Posts: 3
|
Thank you for your reply, and sorry for my late reply but I've been on vacation a couple of weeks.
I've checked if XA transactions was enabled, which is was, and the amqmtsxatm.dll library was defined in the registry, but the problems remains.
The distributed transaction is local (from websphere mq to microsoft mq on the same machine), but I've checked the network dtc access as well, and it is enabled.
Any more suggestions? It's hard to debug and look for errors when nothing more than a "generic" error code is returned.
------------
Update, when looking in the windows event log, the following warning was posted by websphere:
Code: |
Event Type: Warning
Event Source: WebSphere MQ
Event Category: None
Event ID: 8561
Description:
Domain controller unavailable.
WebSphere MQ was unable to contact the domain controller to obtain information for user 'network service@NT AUTHORITY'.
|
|
|
Back to top |
|
 |
|
|
 |
|
Page 1 of 1 |
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
|
|
|