Reputation: 197
I installed MQ Client(7.0.1) in my computer,and write an app using c# to connect to remote Websphere MQ server.I have reference amqmdnet.dll in my project.below is my connect code:
MQEnvironment.Host = ip address;
MQEnvironment.Channel = channel name;
MQEnvironment.Port = 1414;
MQQueueManager qmgr = new MQQueueManager("qm name");
But when new MQQueueManager(),throw a type initializer for 'IBM.WMO.MQ.QueueManager'. I am very confused about the exception. Can you help me?
Upvotes: 0
Views: 1257
Reputation: 15283
Can you give the complete stack trace of the exception? Type initializer exception occurs when an creation of an class instance fails. This exception is basically a wrapper for an internal exception. So knowing the details of the internal exception is helpful. You can put the MQQueueManager qmgr = new MQQueueManager("qm name");
in a try/catch
block and print the complete exception.
From what I know this exception generally occurs if WMQ Client libraries are not installed. The amqmdnet assembly refers to other WMQ libraries, for example amqxcs2.dll and if they are not installed, this exception can be thrown.
You can use the dspmqver -a command output to check what has been installed.
Upvotes: 1