| Author | 
		  Message
		 | 
		
		  | Deanskibum | 
		  
		    
			  
				 Posted: Wed Apr 16, 2003 12:42 pm    Post subject: [Solved] Unable to open queue | 
				     | 
			   
			 
		   | 
		
		
		   Newbie
 
 Joined: 17 Mar 2003 Posts: 4
  
  | 
		  
		    
			  
				Hello,
 
 
I'm trying to run a pub/sub example. I already know about MQJMS_PSQ.mqsc and have run this on my local default Queue Manager and have viewed the system object to confirm they were created. The Queue and listener are running. In JMSAdmin I entered:
 
 
DEF TCF(psTcf) TRANSPORT(CLIENT) QMANAGER(QM_s80am227338) HOST(S80AM227338)PORT(1414) CHANNEL(SYSTEM.DEF.SVRCONN) BROKERQMGR(S80AM227338.QM_s80am227338) BROKERCONQ(SYSTEM.BROKER.CONTROL.QUEUE) BROKERPUBQ(SYSTEM.BROKER.DEFAULT.STREAM) BROKERSUBQ(SYSTEM.JMS.ND.SUBSCRIBER.QUEUE) BROKERCCSUBQ(SYSTEM.JMS.ND.CC.SUBSCRIBER.QUEUE) 
 
 
and run the program:
 
 
import java.util.*; 
 
import javax.jms.*; 
 
import javax.naming.directory.*; 
 
import javax.naming.*; 
 
public class JMSPublisher { 
 
/** 
 
*The main method 
 
*@param no args 
 
*/ 
 
public static void main(String [] args){ 
 
String topicName ="psTopic"; 
 
String tcfName ="psTcf"; 
 
Context jndiContext =null; 
 
TopicConnectionFactory topicConnectionFactory =null; 
 
TopicConnection topicConnection =null; 
 
TopicSession topicSession =null; 
 
Topic topic =null; 
 
TopicPublisher publisher =null; 
 
TextMessage message =null; 
 
String providerUrl ="file:/D:/JNDIDirectory"; 
 
String initialContextFactory ="com.sun.jndi.fscontext.RefFSContextFactory"; 
 
//Step 2 Set up an Initial context for JNDI lookUp. 
 
try { 
 
Hashtable env =new Hashtable(); 
 
env.put(Context.INITIAL_CONTEXT_FACTORY,initialContextFactory); 
 
env.put(Context.PROVIDER_URL ,providerUrl ); 
 
jndiContext =new InitialDirContext(env); 
 
//Step 3 Obtain a TopicConnection factory 
 
topicConnectionFactory = 
 
(TopicConnectionFactory)jndiContext.lookup(tcfName); 
 
//Step 4 Create a Topic Connection using the connection factory object 
 
topicConnection =topicConnectionFactory.createTopicConnection(); 
 
//Step 5 Start the topic connection. 
 
topicConnection.start(); 
 
 
//Step 6 Obtain a Topic from the JNDI 
 
topic =(Topic)jndiContext.lookup(topicName); 
 
//Step 7 Create a Topic Session from the topic connection 
 
topicSession =topicConnection.createTopicSession(false, 
 
Session.AUTO_ACKNOWLEDGE); 
 
//Step 8 Create a topic publisher for the topic from the session. 
 
publisher =topicSession.createPublisher(topic); 
 
//Step 9 Create a message object 
 
message =topicSession.createTextMessage(); 
 
//Step 10 prepare the body of the message 
 
message.setText("This is a Test Message from JMSPublisher Class ") 
 
; 
 
//Step 11 Publish the message. 
 
publisher.publish(message); 
 
//Step 12 Close the connections. 
 
publisher.close(); 
 
topicSession.close(); 
 
topicConnection.close(); 
 
} 
 
catch(JMSException  je ){ 
 
je.printStackTrace();
 
System.out.println(je.getLinkedException());
 
}
 
catch(Exception  e ){ 
 
e.printStackTrace();
 
 
}  
 
} 
 
} 
 
 
 
 
 
All goes well until the line 
 
subscriber =topicSession.createSubscriber(topic) 
 
at which time I get an exception 
 
javax.jms.JMSException: MQJMS2008: failed to open MQ queue
 
at com.ibm.mq.jms.services.ConfigEnvironment.newException(ConfigEnvironment.java:530)at com.ibm.mq.jms.MQTopicSession.createPublisher(MQTopicSession.java:898)at JMSPublisher.main(JMSPublisher.java:42)
 
 
with the linked exception:
 
com.ibm.mq.MQException: MQJE001: Completion Code 2, Reason 2087
 
 
I've stared at the queue until I'm blue in the face. Does anyone see my blunder?
 
 
Thanks
 
Dean | 
			   
			 
		   | 
		
		
		  | Back to top | 
		  
		  	
		   | 
		
		
		    | 
		
		
		  | bower5932 | 
		  
		    
			  
				 Posted: Wed Apr 16, 2003 1:28 pm    Post subject:  | 
				     | 
			   
			 
		   | 
		
		
		    Jedi Knight
 
 Joined: 27 Aug 2001 Posts: 3023 Location: Dallas, TX, USA 
  | 
		  
		    
			  
				The 2087 is telling you that you have an unknown remote queue manager.  I believe this is coming from your:
 
 
BROKERQMGR(S80AM227338.QM_s80am227338)
 
 
on your tcf.  I think your qmgr name is QM_s80am227338.  However, if your broker is running locally (and it probably is), you can create the tcf without specifying this parameter. | 
			   
			 
		   | 
		
		
		  | Back to top | 
		  
		  	
		   | 
		
		
		    | 
		
		
		  | Deanskibum | 
		  
		    
			  
				 Posted: Wed Apr 16, 2003 1:44 pm    Post subject:  | 
				     | 
			   
			 
		   | 
		
		
		   Newbie
 
 Joined: 17 Mar 2003 Posts: 4
  
  | 
		  
		    
			  
				Thanks for the quick reply. I tried your advise but then get a linked exception of:
 
javax.jms.JMSException: MQJMS2008: failed to open MQ queue
 
	at com.ibm.mq.jms.services.ConfigEnvironment.newException(ConfigEnvironment.java:530)
 
	at com.ibm.mq.jms.MQTopicSession.createPublisher(MQTopicSession.java:898)
 
	at JMSPublisher.main(JMSPublisher.java:42)
 
com.ibm.mq.MQException: MQJE001: Completion Code 2, Reason 2085
 
 
Which, as I recall, is unknown object. | 
			   
			 
		   | 
		
		
		  | Back to top | 
		  
		  	
		   | 
		
		
		    | 
		
		
		  | bower5932 | 
		  
		    
			  
				 Posted: Thu Apr 17, 2003 6:45 am    Post subject:  | 
				     | 
			   
			 
		   | 
		
		
		    Jedi Knight
 
 Joined: 27 Aug 2001 Posts: 3023 Location: Dallas, TX, USA 
  | 
		  
		    
			  
				| 2085 is definitely unknown object.  I'd suggest that you display the contents of your TCF and make sure that the queue names that are in it really exist for your qmgr.  And, the case is important. | 
			   
			 
		   | 
		
		
		  | Back to top | 
		  
		  	
		   | 
		
		
		    | 
		
		
		  | Deanskibum | 
		  
		    
			  
				 Posted: Thu Apr 17, 2003 8:59 am    Post subject:  | 
				     | 
			   
			 
		   | 
		
		
		   Newbie
 
 Joined: 17 Mar 2003 Posts: 4
  
  | 
		  
		    
			  
				Thanks for staying with me. I copied the results of the display below. While I can not find a way to copy the screen from MQ explorer, I swear the subscriber queues are the same (all upper case). I have to be doing something so the code is looking at the wrong queue manager.
 
 
BROKERCCSUBQ(SYSTEM.JMS.ND.CC.SUBSCRIBER.QUEUE)
 
BROKERPUBQ(SYSTEM.BROKER.DEFAULT.STREAM)
 
QMANAGER(QM_s80am227338)
 
SUBSTORE(MIGRATE)
 
BROKERVER(V1)
 
USECONNPOOLING(YES)
 
POLLINGINT(5000)
 
RESCANINT(5000)
 
CLONESUPP(DISABLED)
 
BROKERQMGR()
 
BROKERSUBQ(SYSTEM.JMS.ND.SUBSCRIBER.QUEUE)
 
STATREFRESHINT(60000)
 
TRANSPORT(CLIENT)
 
HOSTNAME(S80AM227338)
 
CHANNEL(SYSTEM.DEF.SVRCONN)
 
SYNCPOINTALLGETS(NO)
 
PUBACKINT(25)
 
CCSID(819)
 
CLEANUPINT(3600000)
 
PORT(1414)
 
MSGSELECTION(CLIENT)
 
VERSION(2)
 
MSGBATCHSZ(10)
 
BROKERCONQ(SYSTEM.BROKER.CONTROL.QUEUE)
 
FAILIFQUIESCE(YES)
 
CLEANUP(SAFE) | 
			   
			 
		   | 
		
		
		  | Back to top | 
		  
		  	
		   | 
		
		
		    | 
		
		
		  | Deanskibum | 
		  
		    
			  
				 Posted: Mon Apr 21, 2003 3:04 pm    Post subject:  | 
				     | 
			   
			 
		   | 
		
		
		   Newbie
 
 Joined: 17 Mar 2003 Posts: 4
  
  | 
		  
		    
			  
				Just to close the loop. I finally figured out my problem. It was dumb, I had not started the broker    | 
			   
			 
		   | 
		
		
		  | Back to top | 
		  
		  	
		   | 
		
		
		    | 
		
		
		  | 
		    
		   |