| Author | 
		  Message
		 | 
		
		  | Vin | 
		  
		    
			  
				 Posted: Wed Aug 25, 2004 1:50 pm    Post subject: question on mqseries pub/sub | 
				     | 
			   
			 
		   | 
		
		
		   Master
 
 Joined: 25 Mar 2002 Posts: 212 Location: India 
  | 
		  
		    
			  
				just getting my hands dirty on MQSeries pub/sub. I tried running the sample program JMSPubSub with the publisher option and it went fine. When I tried to use the same program as a subscriber I'm getting the following message
 
 
 Exception in thread "main" javax.jms.JMSException: MQJMS2008: failed to open MQ queue
 
 
In a pub/sub do I need to create a queue for the subscriber to register its subscription? I have the broker running on my machine and I'm using the MA0C support pac. Do I need to create a queue with the same name as the topic that I'm using for publishing the messages? appreciate your help | 
			   
			 
		   | 
		
		
		  | Back to top | 
		  
		  	
		   | 
		
		
		    | 
		
		
		  | bower5932 | 
		  
		    
			  
				 Posted: Thu Aug 26, 2004 5:23 am    Post subject:  | 
				     | 
			   
			 
		   | 
		
		
		    Jedi Knight
 
 Joined: 27 Aug 2001 Posts: 3023 Location: Dallas, TX, USA 
  | 
		  
		    
			  
				| There is a mqjms_psq.mqsc file in the java\bin subdirectory that needs to be run to set up JMS queue definitions. | 
			   
			 
		   | 
		
		
		  | Back to top | 
		  
		  	
		   | 
		
		
		    | 
		
		
		  | bower5932 | 
		  
		    
			  
				 Posted: Thu Aug 26, 2004 5:30 am    Post subject:  | 
				     | 
			   
			 
		   | 
		
		
		    Jedi Knight
 
 Joined: 27 Aug 2001 Posts: 3023 Location: Dallas, TX, USA 
  | 
		  
		    
			  
				I just tried the JMSPubSub and it worked for me.  I had already created my JMS definitions via the mqsc file, so that is probably your error.
 
 
Also, if you are just starting out with publish/subscribe, there are also a couple of samples at:
 
 
http://www.developer.ibm.com/tech/sampmq.html
 
 
You can look for mqjmspub.java and mqjmssub.java.  They also have a link in the prologue to instructions on how to run them. | 
			   
			 
		   | 
		
		
		  | Back to top | 
		  
		  	
		   | 
		
		
		    | 
		
		
		  | Vin | 
		  
		    
			  
				 Posted: Thu Aug 26, 2004 9:52 am    Post subject:  | 
				     | 
			   
			 
		   | 
		
		
		   Master
 
 Joined: 25 Mar 2002 Posts: 212 Location: India 
  | 
		  
		    
			  
				Thanks for the reply guys but the problem is like this. 
 
 
I'm able to run the JMSPubSub if the broker is running on the local queue manager and I want to publish and subscribe to a certain topic, but if the queuemanager itself is remote and I have a client connection to it using JMS, I"m able to publish the message fine but while subscribing to it I get the message "Failed to open MQQueue". 
 
 
My question is if the queuemanager is remote how do I subscribe to the topic? do I have to define any channels from the MQ side? | 
			   
			 
		   | 
		
		
		  | Back to top | 
		  
		  	
		   | 
		
		
		    | 
		
		
		  | jefflowrey | 
		  
		    
			  
				 Posted: Thu Aug 26, 2004 9:54 am    Post subject:  | 
				     | 
			   
			 
		   | 
		
		
		   Grand Poobah
 
 Joined: 16 Oct 2002 Posts: 19981
  
  | 
		  
		    
			  
				
   
	| Vin wrote: | 
   
  
	|  but while subscribing to it I get the message "Failed to open MQQueue".  | 
   
 
 
What is the reason code/linked exception? _________________ I am *not* the model of the modern major general. | 
			   
			 
		   | 
		
		
		  | Back to top | 
		  
		  	
		   | 
		
		
		    | 
		
		
		  | bower5932 | 
		  
		    
			  
				 Posted: Thu Aug 26, 2004 10:05 am    Post subject:  | 
				     | 
			   
			 
		   | 
		
		
		    Jedi Knight
 
 Joined: 27 Aug 2001 Posts: 3023 Location: Dallas, TX, USA 
  | 
		  
		    
			  
				I just re-ran it with a client connection, and it works fine.  Modify the code to catch the linked exception:
 
   
	| Code: | 
   
  
	
 
   } catch( JMSException je ) {
 
      System.out.println("JMS Exception: " + je);
 
      // check for a linked exception
 
      Exception le = je.getLinkedException();
 
      if (le != null) {
 
         System.out.println("Linked exception: " + le);
 
      }
 
  } | 
   
 
 | 
			   
			 
		   | 
		
		
		  | Back to top | 
		  
		  	
		   | 
		
		
		    | 
		
		
		  | Vin | 
		  
		    
			  
				 Posted: Thu Aug 26, 2004 3:05 pm    Post subject:  | 
				     | 
			   
			 
		   | 
		
		
		   Master
 
 Joined: 25 Mar 2002 Posts: 212 Location: India 
  | 
		  
		    
			  
				Here is the linked exception
 
 
Linked Exception com.ibm.mq.MQException: MQJE001: Completion Code 2, Reason 2085 | 
			   
			 
		   | 
		
		
		  | Back to top | 
		  
		  	
		   | 
		
		
		    | 
		
		
		  | fjb_saper | 
		  
		    
			  
				 Posted: Thu Aug 26, 2004 3:13 pm    Post subject:  | 
				     | 
			   
			 
		   | 
		
		
		    Grand High Poobah
 
 Joined: 18 Nov 2003 Posts: 20768 Location: LI,NY 
  | 
		  
		    
			  
				2085 MQRC_UNKNOWN_OBJECT_NAME
 
 
Are you sure all your object are defined right and or that you are accessing the right qmgr ? | 
			   
			 
		   | 
		
		
		  | Back to top | 
		  
		  	
		   | 
		
		
		    | 
		
		
		  | joerg.sailer | 
		  
		    
			  
				 Posted: Fri Aug 27, 2004 3:38 am    Post subject: javax.jms.JMSException: MQJMS2008: failed to open MQ queue | 
				     | 
			   
			 
		   | 
		
		
		   Newbie
 
 Joined: 09 Aug 2004 Posts: 4 Location: Germany 
  | 
		  
		    
			  
				Hello,
 
just check the parameters of the queue-handle-constructor. This exception will also be thrown if you try to USE a wrong/invalid handle.
 
 
The parameters of the constructor are named very curious, so I prefer to use the default-constructor MQQueue() and set the queue-manager and the queue-name by using
 
 
	mqq.setBaseQueueManagerName(queueMgr);
 
	mqq.setBaseQueueName(queueName);
 
 
 
Joerg | 
			   
			 
		   | 
		
		
		  | Back to top | 
		  
		  	
		   | 
		
		
		    | 
		
		
		  | bower5932 | 
		  
		    
			  
				 Posted: Fri Aug 27, 2004 6:30 am    Post subject:  | 
				     | 
			   
			 
		   | 
		
		
		    Jedi Knight
 
 Joined: 27 Aug 2001 Posts: 3023 Location: Dallas, TX, USA 
  | 
		  
		    
			  
				
   
	| bower5932 wrote: | 
   
  
	| There is a mqjms_psq.mqsc file in the java\bin subdirectory that needs to be run to set up JMS queue definitions. | 
   
 
 
 
Double-check that you actually used runmqsc with this file against your qmgr.  This is the file that defines queues that are needed for subscribers. | 
			   
			 
		   | 
		
		
		  | Back to top | 
		  
		  	
		   | 
		
		
		    | 
		
		
		  | 
		    
		   |