简体   繁体   中英

MQ-7 connectivity issue

Hi below is the code I used to check the connectivity

String qManager="";

int openOptions =  CMQC.MQOO_FAIL_IF_QUIESCING + CMQC.MQOO_INPUT_SHARED + CMQC.MQOO_INQUIRE+CMQC.MQOO_BROWSE;

try{
        Hashtable props = new Hashtable();

        props.put(CMQC.HOST_NAME_PROPERTY, "IP"); 
        props.put(CMQC.PORT_PROPERTY, port_num);
        props.put(CMQC.CHANNEL_PROPERTY, "SYSTEM.DEFAULT.LOCAL.QUEUE");

        MQQueueManager qMgr = new MQQueueManager("QM", props);

        MQQueue destQueue = qMgr.accessQueue("Q_name",   openOptions);
        System.out.println("Connected");

        destQueue.close();
        qMgr.disconnect();
}catch(MQException mqe){
    System.out.println(mqe.reasonCode);
}
}   

}

When I run the program I get this Exception

MQJE001: An MQException occurred: Completion Code 2, Reason 2009
MQJE016: MQ queue manager closed channel immediately during connect
2009
Closure reason = 2009
MQJE001: Completion Code 2, Reason 2009

Kindly help me

There are 2 things I suspect here:

  1. props.put(CMQC.HOST_NAME_PROPERTY, "IP"); <-- Is the hostname so short?
  2. props.put(CMQC.CHANNEL_PROPERTY, "SYSTEM.DEFAULT.LOCAL.QUEUE"); <-- Why is the local queue name set as channel property

There are some samples in the "tools" folder of MQ installation, that can help you.

I got this error bcoz in IBM Websphere MQ-7 the channel security was enabled. After Disabling the channel security i was able to connect it

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM