|   | 
	 
  
    | 
RSS Feed - WebSphere MQ Support
 | 
RSS Feed - Message Broker Support
 |   
 
  
	     | 
	 | 
   
 
  
	|  Mq .NET client "unknown object error" when accessi | 
	« View previous topic :: View next topic »  | 
   
  
  	
	  
		
		
		  | Author | 
		  Message
		 |  
		
		  | swood | 
		  
		    
			  
				 Posted: Sun Jan 16, 2005 1:22 pm    Post subject: Mq .NET client "unknown object error" when accessi | 
				     | 
			   
			 
		   | 
		 
		
		   Novice
 
 Joined: 10 Dec 2004 Posts: 20
  
  | 
		  
		    
			  
				This implementation is currently a windows service running under an administrators' account that matches the MQServer's account. This was changed to a windows app for debugging and I am now logging in under the matching user name and password.
 
 
I am recieving an unknown object error when trying to access a queue on the customer's MQ Server.  I previously was recieving a 2059 on the connection to the queue manager but this was solved by making the user names match on client and server.  I am presuming that this means the qm connection is okay now (qm object returned  has a property isConnected=true). The current error is thrown at the AccessQueue method call, not the Put call.
 
 
The unknown object error does not happen when I use the amqputc test app. 
 
 
I see some code that sets properties(hostname,port,channel) in the MQEnvironment class, is this necessary if the MQSERVER=channel/server(port) environment variable is set for windows?  I am currently using a hashtable but I did run into a problem setting the username and password in the hashtable ( didn't work ) and ended up creating the matching username and password between servers.
 
 
connection code fragment:
 
 
Dim ConSettings As Hashtable = New Hashtable()
 
        ConSettings.Add(IBM.WMQ.MQC.CHANNEL_PROPERTY, _ClientChannel)
 
        ConSettings.Add(IBM.WMQ.MQC.HOST_NAME_PROPERTY, _HostName)
 
        ConSettings.Add(IBM.WMQ.MQC.PORT_PROPERTY, _PortNumber)
 
 
 
_QM = New MQQueueManager(_QueueManager, _ConSettings)
 
 
 
put message code fragment:
 
 
                _pmo = New MQPutMessageOptions()
 
                _pmo.Options = 0
 
                _pmo.Options = _pmo.Options + MQC.MQPMO_FAIL_IF_QUIESCING _
 
                                          + MQC.MQPMO_NO_SYNCPOINT _
 
                                          + MQC.MQPMO_DEFAULT_CONTEXT
 
                _Msg = New MQMessage() 'create a buffer to hold the outgoing message 
 
 
                With _Msg
 
 
                        .MessageId = MQC.MQCI_NONE 
 
                        .CorrelationId = MQC.MQCI_NONE
 
                        .Feedback = MQC.MQFB_QUIT
 
                        .Expiry = -1
 
                        .Format = MQC.MQFMT_STRING
 
                        .MessageType = MQC.MQMT_DATAGRAM
 
                        .Persistence = MQC.MQPER_NOT_PERSISTENT
 
                        .Priority = 0
 
                        .WriteString(message)
 
 
                End With
 
 
                Dim _Queue As MQQueue = _QM.AccessQueue(QueueName, _pmo.Options)
 
                _Queue.Put(_Msg, _pmo)
 
                '_QM.Put(QueueName, _QueueManager, _Msg, _pmo) 
 
 
 
Any help would be greatly appreciated _________________ I don't know as much as I wish I did. | 
			   
			 
		   | 
		 
		
		  | Back to top | 
		  
		  	
		   | 
		 
		
		    | 
		 
		
		  | jefflowrey | 
		  
		    
			  
				 Posted: Sun Jan 16, 2005 1:35 pm    Post subject:  | 
				     | 
			   
			 
		   | 
		 
		
		   Grand Poobah
 
 Joined: 16 Oct 2002 Posts: 19981
  
  | 
		  
		    
			  
				Where do you set QueueName? _________________ I am *not* the model of the modern major general. | 
			   
			 
		   | 
		 
		
		  | Back to top | 
		  
		  	
		   | 
		 
		
		    | 
		 
		
		  | fjb_saper | 
		  
		    
			  
				 Posted: Sun Jan 16, 2005 1:43 pm    Post subject:  | 
				     | 
			   
			 
		   | 
		 
		
		    Grand High Poobah
 
 Joined: 18 Nov 2003 Posts: 20768 Location: LI,NY 
  | 
		  
		    
			  
				Are you sure you are using the right case for the queue name.
 
Must be set just like it shows when doing a display with runmqsc
 
Enjoy    | 
			   
			 
		   | 
		 
		
		  | Back to top | 
		  
		  	
		   | 
		 
		
		    | 
		 
		
		  | swood | 
		  
		    
			  
				 Posted: Sun Jan 16, 2005 6:17 pm    Post subject:  | 
				     | 
			   
			 
		   | 
		 
		
		   Novice
 
 Joined: 10 Dec 2004 Posts: 20
  
  | 
		  
		    
			  
				Sorry,
 
this is all triggered by a windows service that uses this component to communicate with the MQServer.  On the specified hour, the service will pull data from a database using parameters from an entry in a Queue table and send it to the MQServer for processing.  The service will try to connect a specified amount of times before notifying of the error so...the service creates the component, calls the connect method and when it returns with a connection it draws the message data from the db and puts it in the MQServer Queue by calling the component's PutMessage method.  On successful completion the entry in the Queue table in the db is removed.
 
 
The hostname(ip address), Queue Manager name( all caps ), channel name( all caps),and port number, are passed to the constructor on creation.
 
 
    Sub New(ByVal HostName As String, ByVal QueueManager As String, ByVal ClientChannel As String, ByVal PortNumber As Integer, ByVal RetryCount As Integer, ByVal WaitInterval As Integer)
 
        _HostName = HostName
 
        _QueueManager = QueueManager
 
        _PortNumber = PortNumber
 
        _RetryCount = RetryCount
 
        _WaitInterval = WaitInterval
 
        _ClientChannel = ClientChannel
 
    End Sub
 
 
The QueueName (all caps), message ( string ), and message id (integer) are passed to the PutMessage method after the message is created by the winservice 
 
 
    Public Sub PutMessage(ByVal message As String, ByVal QueueName As String, ByVal MessageID As String) _________________ I don't know as much as I wish I did. | 
			   
			 
		   | 
		 
		
		  | Back to top | 
		  
		  	
		   | 
		 
		
		    | 
		 
		
		  | jefflowrey | 
		  
		    
			  
				 Posted: Mon Jan 17, 2005 3:51 am    Post subject:  | 
				     | 
			   
			 
		   | 
		 
		
		   Grand Poobah
 
 Joined: 16 Oct 2002 Posts: 19981
  
  | 
		  
		    
			  
				Okay.
 
 
Lemme try again.
 
 
You likely have set QueueName incorrectly. _________________ I am *not* the model of the modern major general. | 
			   
			 
		   | 
		 
		
		  | Back to top | 
		  
		  	
		   | 
		 
		
		    | 
		 
		
		  | swood | 
		  
		    
			  
				 Posted: Mon Jan 17, 2005 6:31 am    Post subject:  | 
				     | 
			   
			 
		   | 
		 
		
		   Novice
 
 Joined: 10 Dec 2004 Posts: 20
  
  | 
		  
		    
			  
				Okay fixed the problem,
 
 
it seems to be in the way I set up the PutMessageOptions.
 
 
...Originally tried...
 
 
_pmo = New MQPutMessageOptions() 
 
_pmo.Options = 0 
 
_pmo.Options = _pmo.Options + MQC.MQPMO_FAIL_IF_QUIESCING _ 
 
+ MQC.MQPMO_NO_SYNCPOINT _ 
 
+ MQC.MQPMO_DEFAULT_CONTEXT
 
 
_QM.Put(QueueName,_QueueManager,_Msg,_pmo)
 
 
...This resulted in the 2085 unknown object error...
 
 
 
 
...Then tried to break up the calls to make a put, for debugging...
 
 
Dim _Queue as MQQueue=_MQ.AccessQueue(QueueName,_pmo)
 
_Queue.Put(_Msg,_pmo)
 
 
...This resulted in the 2085 unknown object error at the AccessQueue method call...
 
 
 
...Got some rest over the weekend and checked the amqsput.vb example for the basic put code since it works from the command line test app...
 
 
...This fixed it...
 
 
With _Msg 
 
 
 
.Format = MQC.MQFMT_STRING 
 
.WriteString(message) 
 
 
End With 
 
 
 
Dim _Queue as MQQueue=_MQ.AccessQueue(QueueName,MQC.MQPMO_FAIL_IF_QUIESCING + MQC.MQOO_OUTPUT)
 
 
_pmo = New MQPutMessageOptions() 
 
_Queue.Put(_Msg,_pmo)
 
 
...It appears that the AccessQueue method must set up the pmo options and the Put just uses an empty instance of the PutMessageOptions class??
 
 
...Anyway, it works now but I'm sure the message properties and pmo options need improvement...any suggestions in this area? _________________ I don't know as much as I wish I did. | 
			   
			 
		   | 
		 
		
		  | 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
  | 
  		 
	   
	 | 
   
 
  	 | 
	  |