|   | 
	 
  
    | 
RSS Feed - WebSphere MQ Support
 | 
RSS Feed - Message Broker Support
 |   
 
  
	     | 
	 | 
   
 
  
	|  The type initializer for 'IBM.WMQ.Nmqi.BindingsNmqiMQ' threw | 
	« View previous topic :: View next topic »  | 
   
  
  	
	  
		
		
		  | Author | 
		  Message
		 |  
		
		  | simonalexander2005 | 
		  
		    
			  
				 Posted: Mon Jun 13, 2016 12:36 am    Post subject: The type initializer for 'IBM.WMQ.Nmqi.BindingsNmqiMQ' threw | 
				     | 
			   
			 
		   | 
		 
		
		   Acolyte
 
 Joined: 13 Jun 2016 Posts: 55
  
  | 
		  
		    
			  
				When trying to connect to MQ in bindings mode (I have a server set up locally), I get the following exception:
 
 
   
	| Quote: | 
   
  
	 System.TypeInitializationException: The type initializer for 'IBM.WMQ.Nmqi.BindingsNmqiMQ' threw an exception. ---> System.NullReferenceException: Object reference not set to an instance of an object.
 
   at IBM.WMQ.Nmqi.NativeManager.InitializeNativeApis(String mode)
 
   at IBM.WMQ.Nmqi.BindingsNmqiMQ..cctor()
 
   --- End of inner exception stack trace ---
 
   at System.RuntimeMethodHandle.InvokeMethod(Object target, Object[] arguments, Signature sig, Boolean constructor)
 
   at System.Reflection.RuntimeConstructorInfo.Invoke(BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture)
 
   at System.RuntimeType.CreateInstanceImpl(BindingFlags bindingAttr, Binder binder, Object[] args, CultureInfo culture, Object[] activationAttributes, StackCrawlMark& stackMark)
 
   at System.Activator.CreateInstance(Type type, BindingFlags bindingAttr, Binder binder, Object[] args, CultureInfo culture, Object[] activationAttributes)
 
   at System.Reflection.Assembly.CreateInstance(String typeName, Boolean ignoreCase, BindingFlags bindingAttr, Binder binder, Object[] args, CultureInfo culture, Object[] activationAttributes)
 
   at IBM.WMQ.Nmqi.NmqiEnvironment.GetInstance(String name)
 
   at IBM.WMQ.Nmqi.NmqiEnvironment.GetMQI(Int32 id)
 
   at IBM.WMQ.MQQueueManager.Connect(String queueManagerName)
 
   at IBM.WMQ.MQQueueManager..ctor(String queueManagerName, Hashtable properties)
 
   at Project.MQConnector.CreateConnectAndAddQueueManager(QueueManagerConnectionDetails connDetails) | 
   
 
 
The error occurs when trying to connect to a queue manager as follows:
 
 
Constructor:
 
 
   
	| Code: | 
   
  
	Friend queueManagerConnectionProperties As New Hashtable()
 
queueManagerConnectionProperties.Add(MQC.THREAD_AFFINITY_PROPERTY, True)
 
If My.Settings.MQConnectAsClient Then
 
    queueManagerConnectionProperties.Add(MQC.TRANSPORT_PROPERTY, MQC.TRANSPORT_MQSERIES_CLIENT)
 
Else
 
    queueManagerConnectionProperties.Add(MQC.TRANSPORT_PROPERTY, MQC.TRANSPORT_MQSERIES_BINDINGS)
 
End If
 
 
queueManagerConnectionProperties.Add(MQC.CONNECT_OPTIONS_PROPERTY, MQC.MQCNO_HANDLE_SHARE_BLOCK Or MQC.MQCNO_RECONNECT_Q_MGR) ' have handle-sharing with call blocking | 
   
 
 
And in the CreateConnectAndAddQueueManager method (where connDetails is just a store for the port, host, name, etc.):
 
 
   
	| Code: | 
   
  
	 Dim specificQMConnProperties As Hashtable = CType(queueManagerConnectionProperties.Clone(), Hashtable)
 
 specificQMConnProperties.Add(MQC.CHANNEL_PROPERTY, connDetails.Channel)
 
 specificQMConnProperties.Add(MQC.CONNECTION_NAME_PROPERTY, connectionName)
 
 Dim qmgr As MQQueueManager = Nothing
 
 
 Try
 
     qmgr = New MQQueueManager(connDetails.Name, specificQMConnProperties)
 
 Catch ex As MQException
 
     ' error handling
 
 End Try | 
   
 
 
I have the following environment variable:
 
 
   
	| Quote: | 
   
  
	| NMQ_MQ_LIB=mqm.dll | 
   
 
 
When I connect using a managed connection (NMQ_MQ_LIB=managed; and don't set the MQC.TRANSPORT_PROPERTY), it works fine.
 
 
Any thoughts?
 
 
   
	| Quote: | 
   
  
	C:\Program Files\IBM\MQSI\9.0.0.2>dspmqver -a
 
Name:        WebSphere MQ
 
Version:     7.5.0.6
 
Level:       p750-006-160226
 
BuildType:   IKAP - (Production)
 
Platform:    WebSphere MQ for Windows
 
Mode:        32-bit
 
O/S:         Windows 7 Enterprise x64 Edition, Build 7601: SP1
 
InstName:    Installation1
 
InstDesc:
 
Primary:     No
 
InstPath:    C:\Program Files (x86)\IBM\WebSphere MQ
 
DataPath:    C:\Program Files (x86)\IBM\WebSphere MQ
 
MaxCmdLevel: 750
 
LicenseType: Production
 
AMQ8351: WebSphere MQ Java environment has not been configured correctly.
 
AMQ8351: WebSphere MQ Java environment has not been configured correctly.
 
 
Name:        IBM WebSphere MQ custom channel for Windows Communication Foundation
 
Version:     7.5.0.6
 
Level:       wn750-006-151116
 
Build Type:  Production
 
 
 
Name:        IBM Message Service Client for .NET (XMS .NET)
 
Version:     2.5.0.6
 
Level:       nn250-006-151116
 
Build Type:  Production
 
 
 
Name:        IBM Global Security Kit for WebSphere MQ
 
Version:     8.0.14.53
 
Build Type:  Production
 
Mode:        32-bit
 
 
Name:        IBM Global Security Kit for WebSphere MQ
 
Version:     8.0.14.53
 
Build Type:  Production
 
Mode:        64-bit | 
   
 
 | 
			   
			 
		   | 
		 
		
		  | 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
  | 
  		 
	   
	 | 
   
 
  	 | 
	  |