Collectives™ on Stack Overflow
Find centralized, trusted content and collaborate around the technologies you use most.
Learn more about Collectives
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
Learn more about Teams
Hi I have a error when I try to create instance of MQQueueManager. The line 63 (from error) is create instance MQQueueManager.
The queue is configured on machine where I can not login and I don't know that the queue is running.
Is the error can deduce the cause of the failure?
System.TypeInitializationException: The type initializer for 'IBM.WMQ.MQQueueManager' threw an exception. ---> System.Reflection.TargetInvocationException: Exception has been thrown by the target of an invocation. ---> System.Reflection.TargetInvocationException: Exception has been thrown by the target of an invocation. ---> System.NullReferenceException: Object reference not set to an instance of an object.
at IBM.WMQ.Nmqi.NativeManager.InitializeNativeApis(String mode)
--- End of inner exception stack trace ---
at IBM.WMQ.MQCommonServices..ctor()
--- End of inner exception stack trace ---
at System.RuntimeTypeHandle.CreateInstance(RuntimeType type, Boolean publicOnly, Boolean noCheck, Boolean& canBeCached, RuntimeMethodHandle& ctor, Boolean& bNeedSecurityCheck)
at System.RuntimeType.CreateInstanceSlow(Boolean publicOnly, Boolean fillCache)
at System.RuntimeType.CreateInstanceImpl(Boolean publicOnly, Boolean skipVisibilityChecks, Boolean fillCache)
at System.Activator.CreateInstance(Type type, Boolean nonPublic)
at System.RuntimeType.CreateInstanceImpl(BindingFlags bindingAttr, Binder binder, Object[] args, CultureInfo culture, Object[] activationAttributes)
at System.Activator.CreateInstance(Type type, BindingFlags bindingAttr, Binder binder, Object[] args, CultureInfo culture)
at System.RuntimeType.InvokeMember(String name, BindingFlags bindingFlags, Binder binder, Object target, Object[] providedArgs, ParameterModifier[] modifiers, CultureInfo culture, String[] namedParams)
at IBM.WMQ.CommonServices.CreateCommonServices()
at IBM.WMQ.CommonServices.TraceEnabled()
at IBM.WMQ.MQBase..ctor()
at IBM.WMQ.Nmqi.NmqiEnvironment..ctor(NmqiPropertyHandler nmqiPropertyHandler)
at IBM.WMQ.Nmqi.NmqiFactory.GetInstance(NmqiPropertyHandler properties)
at IBM.WMQ.MQQueueManager..cctor()
--- End of inner exception stack trace ---
at IBM.WMQ.MQQueueManager..ctor(String queueManagerName)
at Ccap.Bnp.MQAdapter..ctor() in D:\Programowanie\Xxx\MQAdapter.cs:line 63
–
–
–
–
You are passing just the queue manager name to the MQQueueManager
constructor. Have you initialized MQEnvironment
? You need to initialize MQEnvironment
when using a MQQueueManager
constructor that takes only the queue manager as parameter. The other way is to pass a Hashtable
containing host, port and channel properties to MQQueueManager constructor to establish a connection to a queue manager running on a different machine. If you have not initialized MQEnvironment
or not using a Hashtable
to pass host, port and channel properties, then the MQ.NET
client will attempt to connect to a queue manager running on the same machine as your application.
Also do you have MQ Client installed on the machine where you run your application? You may be attempting to run your application with just AMQMDNET.DLL copied. This is one of the possible cause for System.TypeInitializationException
exception. The AMQMDNET.DLL has dependency on other assemblies and native libraries.
I can update my answer based on your response.
Update
You need MQ Client installed to run your application. Without the MQ Client your application will not work. Download and install MQ Client from here
–
Thanks for contributing an answer to Stack Overflow!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.