gpt4 book ai didi

Java 客户端使用 JMS 连接到 TCP/IP 抛出错误的 IBM MQ channel

转载 作者:行者123 更新时间:2023-11-30 07:40:48 28 4
gpt4 key购买 nike

我们有一个在 Windows 服务器计算机上运行的 IBM MQ Server 7.5。到目前为止,我们在 Windows 上有一个 IBM MQ JMS 客户端(用 groovy 编写)用于读取 TCP channel 上的消息。

我现在的问题是我们必须将客户端移动到 Debian 机器上。我已经下载了适用于 Debian 的 IBM MQ Client 7。

我正在编写示例代码以连接到服务器以读取消息。我正在使用来自 IBM 站点的 JmsPutGet.java 示例。

环境如下:

  1. Java 8
  2. com.ibm.mq.allclient-9.0.4.0.jar
  3. javax.jms-api-2.0.1

我得到的错误是

The value specified for the property is not supported.
Modify the value to be within the range of accepted values.
FAILURE

我也尝试使用连接模式Client,它给出了如下不同的错误:

com.ibm.msg.client.jms.DetailedJMSException: JMSWMQ0018: Failed to connect to queue manager 'VIMSRRI10' with connection mode 'Client' and host name '172.18.21.5(1415)'.
Check the queue manager is started and if running in client mode, check there is a listener running. Please see the linked exception for more information.
Inner exception(s):
com.ibm.mq.MQException: JMSCMQ0001: IBM MQ call failed with compcode '2' ('MQCC_FAILED') reason '2539' ('MQRC_CHANNEL_CONFIG_ERROR').
com.ibm.mq.jmqi.JmqiException: CC=2;RC=2539;AMQ9204: Connection to host '172.18.21.5(1415)' rejected. [1=com.ibm.mq.jmqi.JmqiException[CC=2;RC=2539;AMQ9547: Type of remote channel not suitable for action requested. [3=IRRICI10.VIMSRRI10]],3=172.18.21.5(1415),5=RemoteConnection.analyseErrorSegment]
com.ibm.mq.jmqi.JmqiException: CC=2;RC=2539;AMQ9547: Type of remote channel not suitable for action requested. [3=IRRICI10.VIMSRRI10]
FAILURE

示例 java 代码是:

JmsFactoryFactory ff =  JmsFactoryFactory.getInstance(WMQConstants.WMQ_PROVIDER);
JmsConnectionFactory cf = ff.createConnectionFactory();

// Set the properties
cf.setStringProperty(WMQConstants.WMQ_HOST_NAME, HOST);
cf.setIntProperty(WMQConstants.WMQ_PORT, PORT);
cf.setStringProperty(WMQConstants.WMQ_CHANNEL, CHANNEL);
cf.setIntProperty(WMQConstants.WMQ_CONNECTION_MODE, WMQConstants.WMQ_CM_DIRECT_TCPIP);
cf.setStringProperty(WMQConstants.WMQ_QUEUE_MANAGER, QMGR);
cf.setStringProperty(WMQConstants.WMQ_APPLICATIONNAME, "JmsPutGet (JMS)");
//cf.setBooleanProperty(WMQConstants.USER_AUTHENTICATION_MQCSP, true);
//cf.setStringProperty(WMQConstants.USERID, APP_USER);
//cf.setStringProperty(WMQConstants.PASSWORD, APP_PASSWORD);

// Create JMS objects
context = cf.createContext();
System.out.println("After Context\n");
destination = context.createQueue("queue:///" + QUEUE_NAME);
System.out.println("After Queue\n");
long uniqueNumber = System.currentTimeMillis() % 1000;
TextMessage message = context.createTextMessage("Your lucky number today is " + uniqueNumber);

producer = context.createProducer();
producer.send(destination, message);
System.out.println("Sent message:\n" + message);

consumer = context.createConsumer(destination); // autoclosable
String receivedMessage = consumer.receiveBody(String.class, 15000); // in ms or 15 seconds

System.out.println("\nReceived message:\n" + receivedMessage);

最佳答案

您连接的 channel 必须是 SVRCONN

错误 reason '2539' ('MQRC_CHANNEL_CONFIG_ERROR') 表示您正在连接的 channel 不是 SVRCONN

这在错误的下一行中拼写得更清楚,它还提供了您尝试连接到 IRRICI10.VIMSRRI10 的 channel 的名称:

AMQ9547: Type of remote channel not suitable for action requested. [3=IRRICI10.VIMSRRI10]

channel 本身的名称采用的是 SDRRCVR channel 的通用格式,它们在两个队列管理器之间使用,不适用于 MQ 客户端应用程序连接到。

关于Java 客户端使用 JMS 连接到 TCP/IP 抛出错误的 IBM MQ channel ,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/56984593/

28 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com