简体   繁体   中英

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. Till now we had an IBM MQ JMS client (written in groovy) on Windows for reading messages on a TCP channel.

My problem now is we have to move the Client to a Debian machine. I have downloaded the IBM MQ Client 7 for Debian.

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.

The environment is as follows:

  1. 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:

 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:

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 .

The error reason '2539' ('MQRC_CHANNEL_CONFIG_ERROR') indicates that the channel you are connecting to is not a 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 :

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.

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