【发布时间】:2015-09-21 16:08:01
【问题描述】:
您好,我在尝试创建 MQQueueManager 实例时出错。第 63 行(来自错误)是创建实例 MQQueueManager。
队列是在我无法登录且我不知道队列正在运行的机器上配置的。
错误是否可以推断失败的原因?
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
【问题讨论】:
-
使用的 MQ 版本是什么(客户端和服务器)?你能显示抛出这个异常的代码吗
-
我很想回滚上次的编辑,因为标题最初说这是 MQ v7.5。但是,Umpathy 是正确的,要获得明智的答案需要明确说明客户端和服务器的版本。事实上,请访问 websphere-mq 标签 wiki 以获取有关提供哪些信息以改进您可能得到的答案的指导。即使声誉低下,您也可以随时编辑自己的问题以添加请求的信息。
-
只有我拥有的信息是 MQ 7.5。是不是无法从这个错误日志中推断出失败的原因?
-
System.TypeInitializationException 由 .net 引发。可能是 MQ 连接工厂/构造函数未正确初始化。如果您无法粘贴源代码,建议您阅读 .net 手册并查看您做错了什么。 www-01.ibm.com/support/knowledgecenter/SSFKSJ_7.5.0/….net 样本www-01.ibm.com/support/knowledgecenter/SSFKSJ_7.5.0/…