Java MQJE001:完成代码“2”,原因“2538”

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/21672833/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-08-13 10:01:18  来源:igfitidea点击:

MQJE001: Completion Code '2', Reason '2538'

javaibm-mq

提问by Bhaumik Shah

public class PtpReceiver {

公共类 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);
        }
}

}

}

I got the error following:

我收到以下错误:

MQJE001: Completion Code '2', Reason '2538'.

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

Can any one help me for solve this error

谁能帮我解决这个错误

采纳答案by Roger

That is JMS code for doing a connection via for WMQ for JMS. Bhaumik is using WMQ for Java (non JMS).

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

Bhaumik, you do not specify the port number in the hostname but rather as follows:

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);
        }
}

回答by Aliti

I think it is necessary to define your connection mode like this:

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

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();

I hope it works. For more inormation see this.

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