MQJE001:完成代码'2',原因'2538'

时间:2014-02-10 09:06:25

标签: java ibm-mq

公共类PtpReceiver {

public static void main(String[] args) {
    // TODO Auto-generated method stub
    try {
        MQEnvironment.hostname = "192.168.120.28:1415";
        MQEnvironment.channel = "SFMS.TO.CBS";
        MQEnvironment.properties.put(MQC.TRANSPORT_PROPERTY,
                MQC.TRANSPORT_MQSERIES);
        System.out.println("Q manager");
        MQQueueManager qMgr = new MQQueueManager("GSCBBRQM");
        System.out.println("Q manager11");

    }

    catch (MQException ex) {
        System.out.println(ex.completionCode+ ex.reasonCode);
        }
}

}

我收到了以下错误:

MQJE001:完成代码'2',原因'2538'。

任何人都可以帮我解决此错误

2 个答案:

答案 0 :(得分:1)

我认为有必要像这样定义你的连接模式:

jmsFactory = JmsFactoryFactory.getInstance(WMQConstants.WMQ_PROVIDER);
jcf = jmsFactory.createConnectionFactory();

// Set the properties
jcf.setStringProperty(WMQConstants.WMQ_HOST_NAME, hostName);
jcf.setIntProperty(WMQConstants.WMQ_PORT, port);
jcf.setIntProperty(WMQConstants.WMQ_CONNECTION_MODE, WMQConstants.WMQ_CM_CLIENT);
jcf.setStringProperty(WMQConstants.WMQ_CHANNEL, channel);

connection = jcf.createConnection();

我希望它有效。 有关更多信息,请参阅this

答案 1 :(得分:1)

这是用于通过WMQ for JMS进行连接的JMS代码。 Bhaumik正在使用WMQ for Java(非JMS)。

Bhaumik,您没有在主机名中指定端口号,而是如下:

public static void main(String[] args) {
    try {
        MQEnvironment.hostname = "192.168.120.28";
        MQEnvironment.port     = 1415;
        MQEnvironment.channel  = "SFMS.TO.CBS";
        MQQueueManager qMgr = new MQQueueManager("GSCBBRQM");
    }

    catch (MQException ex) {
        System.out.println("CC="+ex.completionCode + " : RC="+ ex.reasonCode);
        }
}