按照一个稍微修改的例子,我有:
public class MqTestClient {
public static void main(String[] args) throws Exception {
MQQueueConnectionFactory factory =
new MQQueueConnectionFactory();
factory.setTransportType(WMQConstants.WMQ_CM_CLIENT);
factory.setHostName("127.0.0.1");
factory.setPort(1414);
factory.setQueueManager("QMA");
factory.setChannel("FROM_CHANNEL");
MQQueue queue = new MQQueue("QUEUE_FROM");
// connection pooling
MQEnvironment.addConnectionPoolToken();
System.out.println("Sending...");
for (int i = 0; i < 5; i++) {
MQQueueConnection con = (MQQueueConnection)
factory.createConnection();
使用 MQ Explorer,我设置了一个接收器通道 FROM_CHANNEL 和一个本地队列 QUEUE_FROM。这一切都在一台 Ubuntu 机器上运行。我得到“远程通道类型不适合请求的操作”。从我的搜索来看,这似乎只是指发送方未发送到接收方通道,在这种情况下并非如此。
Exception in thread "main" com.ibm.msg.client.jms.DetailedJMSException: JMSWMQ0018: null
at com.ibm.msg.client.wmq.common.internal.Reason.reasonToException(Reason.java:585)
at com.ibm.msg.client.wmq.common.internal.Reason.createException(Reason.java:221)
at com.ibm.msg.client.wmq.internal.WMQConnection.<init>(WMQConnection.java:426)
at com.ibm.msg.client.wmq.factories.WMQConnectionFactory.createV7ProviderConnection(WMQConnectionFactory.java:6902)
at com.ibm.msg.client.wmq.factories.WMQConnectionFactory.createProviderConnection(WMQConnectionFactory.java:6277)
at com.ibm.msg.client.jms.admin.JmsConnectionFactoryImpl.createConnection(JmsConnectionFactoryImpl.java:285)
at com.ibm.mq.jms.MQConnectionFactory.createCommonConnection(MQConnectionFactory.java:6233)
at com.ibm.mq.jms.MQQueueConnectionFactory.createQueueConnection(MQQueueConnectionFactory.java:120)
at com.ibm.mq.jms.MQQueueConnectionFactory.createConnection(MQQueueConnectionFactory.java:203)
at MqTestClient.main(MqTestClient.java:33)
Caused by: com.ibm.mq.MQException: JMSCMQ0001: JMSCMQ0001, 2, MQCC_FAILED, 2539, MQRC_CHANNEL_CONFIG_ERROR
at com.ibm.msg.client.wmq.common.internal.Reason.createException(Reason.java:209)
... 8 more
Caused by: com.ibm.mq.jmqi.JmqiException: CC=2;RC=2539;AMQ9204: Connection to host '127.0.0.1(1414)' rejected. [1=com.ibm.mq.jmqi.JmqiException[CC=2;RC=2539;AMQ9547: Type of remote channel not suitable for action requested. [3=FROM_CHANNEL]],3=127.0.0.1(1414),5=RemoteConnection.analyseErrorSegment]
at com.ibm.mq.jmqi.remote.api.RemoteFAP.jmqiConnect(RemoteFAP.java:2053)
at com.ibm.mq.jmqi.remote.api.RemoteFAP.jmqiConnect(RemoteFAP.java:1226)
at com.ibm.msg.client.wmq.internal.WMQConnection.<init>(WMQConnection.java:346)
... 7 more
Caused by: com.ibm.mq.jmqi.JmqiException: CC=2;RC=2539;AMQ9547: Type of remote channel not suitable for action requested. [3=FROM_CHANNEL]