| Author | 
		  Message
		 | 
		
		  | saadz | 
		  
		    
			  
				 Posted: Thu Sep 28, 2006 7:18 am    Post subject: Using Java PCF program on windows to connect AIX | 
				     | 
			   
			 
		   | 
		
		
		   Newbie
 
 Joined: 10 Apr 2006 Posts: 5
  
  | 
		  
		    
			  
				Hi Guys,
 
 
I am trying to run following program to get Queue Names. When I try to connect Windows Server it is working fine but when I run this program on Windows to connect to MQ on AIX box it's giving me an error. Please let me know if I need to define username/password somewhere?
 
 
   
	| Code: | 
   
  
	import java.io.*;
 
import com.ibm.mq.*;
 
import com.ibm.mq.pcf.*;
 
 
/**
 
 * PCF example class showing use of PCFAgent and com.ibm.mq.pcf structure types
 
 * to generate and parse a PCF query. Note that the list of queue names returned
 
 * includes the dynamic queue used by the PCFAgent; the name of this queue is
 
 * accessible as the replyQueueName field of the PCFAgent object.
 
 *
 
 * @author Chris Markes
 
 */
 
 
public class ListQueueNames
 
{
 
   final public static String copyright = "Copyright (c) IBM Corp. 1998   All rights reserved.";
 
 
   public static void main (String [] args)
 
   {
 
      PCFAgent       agent;
 
      PCFParameter []    parameters =
 
               {
 
                  new MQCFST (CMQC.MQCA_Q_NAME, "*"),
 
                  new MQCFIN (CMQC.MQIA_Q_TYPE, CMQC.MQQT_ALL)
 
               };
 
      MQMessage []       responses;
 
      MQCFH          cfh;
 
      MQCFSL          cfsl;
 
 
      try
 
      {
 
         // Connect a PCFAgent to the specified queue manager
 
 
         if (args.length == 1)
 
         {
 
            System.out.print ("Connecting to local queue manager " +
 
               args [0] + "... ");
 
            agent = new PCFAgent (args [0]);
 
         }
 
         else
 
         {
 
            System.out.print ("Connecting to queue manager at " +
 
               args [0] + ":" + args [1] + " over channel " + args [2] + "... ");
 
            agent = new PCFAgent (args [0], Integer.parseInt (args [1]), args [2]);
 
         }
 
 
         System.out.println ("Connected.");
 
 
         // Use the agent to send the request
 
 
         System.out.print ("Sending PCF request... ");
 
         responses = agent.send (CMQCFC.MQCMD_INQUIRE_Q_NAMES, parameters);
 
         System.out.println ("Received reply.");
 
         cfh = new MQCFH (responses [0]);
 
 
         // Check the PCF header (MQCFH) in the first response message
 
 
         if (cfh.reason == 0)
 
         {
 
            System.out.println ("Queue names:");
 
            cfsl = new MQCFSL (responses [0]);
 
 
            for (int i = 0; i < cfsl.strings.length; i++)
 
            {
 
               System.out.println ("\t" + cfsl.strings [i]);
 
            }
 
         }
 
         else
 
         {
 
            System.out.println (cfh);
 
 
            // Walk through the returned parameters describing the error
 
 
            for (int i = 0; i < cfh.parameterCount; i++)
 
            {
 
               System.out.println (PCFParameter.nextParameter (responses [0]));
 
            }
 
         }
 
 
         // Disconnect
 
 
         System.out.print ("Disconnecting... ");
 
         agent.disconnect ();
 
         System.out.println ("Done.");
 
      }
 
 
      catch (ArrayIndexOutOfBoundsException abe)
 
      {
 
         System.out.println ("Usage: \n" +
 
            "\tjava ListQueueNames queue-manager\n" +
 
            "\tjava ListQueueNames host port channel");
 
      }
 
 
      catch (NumberFormatException nfe)
 
      {
 
         System.out.println ("Invalid port: " + args [1]);
 
         System.out.println ("Usage: \n" +
 
            "\tjava ListQueueNames queue-manager\n" +
 
            "\tjava ListQueueNames host port channel");
 
      }
 
 
      catch (MQException mqe)
 
      {
 
         System.err.println (mqe);
 
      }
 
 
      catch (IOException ioe)
 
      {
 
         System.err.println (ioe);
 
      }
 
   }
 
}
 
 | 
   
 
 
 
Error I am getting is as follows.
 
 
   
	| Code: | 
   
  
	Sending PCF request... MQJE001: Completion Code 2, Reason 2033
 
com.ibm.mq.MQException: MQJE001: Completion Code 2, Reason 2033 | 
   
 
 
 
Thanks in advance.
 
SZ | 
			   
			 
		   | 
		
		
		  | Back to top | 
		  
		  	
		   | 
		
		
		    | 
		
		
		  | vennela | 
		  
		    
			  
				 Posted: Thu Sep 28, 2006 7:42 am    Post subject:  | 
				     | 
			   
			 
		   | 
		
		
		    Jedi Knight
 
 Joined: 11 Aug 2002 Posts: 4055 Location: Hyderabad, India 
  | 
		  
		    
			  
				How are you running this program
 
When you say, 
   
	| Quote: | 
   
  
	| when I run this program on Windows to connect to MQ on AIX box  | 
   
 
 do you mean you are client connecting?
 
Can you explain a little more about the setup | 
			   
			 
		   | 
		
		
		  | Back to top | 
		  
		  	
		   | 
		
		
		    | 
		
		
		  | saadz | 
		  
		    
			  
				 Posted: Thu Sep 28, 2006 7:54 am    Post subject:  | 
				     | 
			   
			 
		   | 
		
		
		   Newbie
 
 Joined: 10 Apr 2006 Posts: 5
  
  | 
		  
		    
			  
				Yes, I am client connecting...
 
When I run this program on my PC (Windows 2000) to connect to MQ installed on Server (Windows 2000) it is working fine.
 
When I am trying to run this program on my PC (Windows 2000) to connect to MQ installed on IBM RISC machine (AIX) it is giving me an error.
 
 
Regards,
 
SZ | 
			   
			 
		   | 
		
		
		  | Back to top | 
		  
		  	
		   | 
		
		
		    | 
		
		
		  | jefflowrey | 
		  
		    
			  
				 Posted: Thu Sep 28, 2006 8:38 am    Post subject:  | 
				     | 
			   
			 
		   | 
		
		
		   Grand Poobah
 
 Joined: 16 Oct 2002 Posts: 19981
  
  | 
		  
		    
			  
				Maybe the AIX machine is not running a command server. _________________ I am *not* the model of the modern major general. | 
			   
			 
		   | 
		
		
		  | Back to top | 
		  
		  	
		   | 
		
		
		    | 
		
		
		  | saadz | 
		  
		    
			  
				 Posted: Thu Sep 28, 2006 9:11 am    Post subject:  | 
				     | 
			   
			 
		   | 
		
		
		   Newbie
 
 Joined: 10 Apr 2006 Posts: 5
  
  | 
		  
		    
			  
				It is running command server, and another program of mine which uses MQQueueConnectionFactory and set username and password in it working fine with AIX box.
 
 
That's the reason I asked is there is any way to set username/password in this PCF class.
 
 
Thanks anyways. | 
			   
			 
		   | 
		
		
		  | Back to top | 
		  
		  	
		   | 
		
		
		    | 
		
		
		  | jefflowrey | 
		  
		    
			  
				 Posted: Thu Sep 28, 2006 12:22 pm    Post subject:  | 
				     | 
			   
			 
		   | 
		
		
		   Grand Poobah
 
 Joined: 16 Oct 2002 Posts: 19981
  
  | 
		  
		    
			  
				You can create an MQQueueManager object on your own and then create a PCFMessageAgent from that.
 
 
A 2033 error is not a security error, though.
 
 
It means that you didn't get a response back from the command server.
 
 
So that is why I suggested that the AIX machine is not running a command server. _________________ I am *not* the model of the modern major general. | 
			   
			 
		   | 
		
		
		  | Back to top | 
		  
		  	
		   | 
		
		
		    | 
		
		
		  | iceage | 
		  
		    
			  
				 Posted: Thu Sep 28, 2006 12:53 pm    Post subject:  | 
				     | 
			   
			 
		   | 
		
		
		    Acolyte
 
 Joined: 12 Apr 2006 Posts: 68
  
  | 
		  
		    
			  
				| If you can verify that command server is running on AIX , Look at the DLQ on your AIX server , messages might be going there because command server replies land up there due to authorization or other errors .. | 
			   
			 
		   | 
		
		
		  | Back to top | 
		  
		  	
		   | 
		
		
		    | 
		
		
		  | 
		    
		   |