简体   繁体   English

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

[英]Java client using JMS for connecting to IBM MQ Channel of TCP/IP throwing error

We have a IBM MQ Server 7.5 running on a Windows server machine. 我们有在Windows服务器计算机上运行的IBM MQ Server 7.5。 Till now we had an IBM MQ JMS client (written in groovy) on Windows for reading messages on a TCP channel. 到目前为止,我们在Windows上有一个IBM MQ JMS客户端(以groovy编写),用于读取TCP通道上的消息。

My problem now is we have to move the Client to a Debian machine. 我现在的问题是我们必须将Client移到Debian机器上。 I have downloaded the IBM MQ Client 7 for Debian. 我已经下载了Debian的IBM MQ Client 7。

I am writting a sample code to connect to the Server to read the messages. 我正在编写一个示例代码以连接到服务器以读取消息。 I am using the JmsPutGet.java example from the IBM site. 我正在使用IBM网站上的JmsPutGet.java示例。

The environment is as follows: 环境如下:

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

The error I get is 我得到的错误是

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

I tried using connection mode Client as well, it gives a different error as below: 我也尝试使用连接模式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 

Sample java code is: 示例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);

The channel you connect to must be a SVRCONN . 您连接的频道必须是SVRCONN

The error reason '2539' ('MQRC_CHANNEL_CONFIG_ERROR') indicates that the channel you are connecting to is not a SVRCONN . 错误reason '2539' ('MQRC_CHANNEL_CONFIG_ERROR')表示您要连接的SVRCONN不是SVRCONN

This is spelled out clearer in the next line of the error which also provides the the name of the channel you are attempting to connect to IRRICI10.VIMSRRI10 : 错误的下一行将更清楚地说明这一点,该错误还提供了您尝试连接到IRRICI10.VIMSRRI10的通道的名称:

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

The name of the channel itself is in a format common for a SDR or RCVR channels which are used between two queue managers, not for a MQ client app to connect to. 通道本身的名称采用两个队列管理器之间使用的SDRRCVR通道通用的格式,而不是用于连接MQ客户端应用程序的通道。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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