JMSWMQ2020:无法连接到队列管理器

时间:2018-01-18 23:03:09

标签: java jms message-queue ibm-mq

我正在尝试使用ccdt.tab文件连接到队列管理器。 这是我试过的:

String CHANNEL_TABLE_PATH = "/usr/dev/ccdt.tab";
URL chanTableUrl = new URL("file://"+ CHANNEL_TABLE_PATH);
connectionFactory.setCCDTURL(chanTableUrl);
connectionFactory.setQueueManager("*");
MQQueueConnection connection = (MQQueueConnection) connectionFactory.createQueueConnection();
connection.start();

这是我的ccdt.tab中的内容

DIS CHL(*) QMNAME CONNAME
Display Channel details.
   CHANNEL(C.TEST.1)                     CHLTYPE(CLNTCONN)
   CONNAME(host1.test.com(1511), host2.test.com(1512))   QMNAME(QQ)
Display Channel details.
   CHANNEL(C.TEST.2)            CHLTYPE(CLNTCONN)
   CONNAME( )                              QMNAME( )

但是,我确实收到了队列连接错误: 线程“main”中的异常java.lang.Exception:JMSWMQ2020:无法使用连接模式'Client'连接到队列管理器'*',并且提供了CCDT URL'文件:/use/test/ccdt.tab',请参阅链接异常更多信息。

我尝试更改为:setQueueManager("*QUEMANAGER")setQueueManager("*")setQueueManager("QMGRNAME") 它返回了同样的错误。我也检查ssl连接,运行正常。

此外,我尝试使用此代码连接到MQ服务器,它完全正常:

connectionFactory.setConnectionNameList("host1.test.com(1511), host2.test.com(1512)");
connectionFactory.setClientReconnectOptions(67108864);
connectionFactory.setClientReconnectTimeout(1800);
connectionFactory.setQueueManager("QQ");
connectionFactory.setChannel("C.TEST.1");
MQQueueConnection connection = (MQQueueConnection) connectionFactory_.createQueueConnection();
connection.start();

有谁知道出了什么问题以及如何解决?

ps:我确实看过那些帖子:Connecting to IBM MQ using CCDT file in JMS

http://javarevisited.blogspot.com/2015/03/webshpere-mq-ssl-errors-java-solution.html#axzz54Zzodg6t

以下是我setQueueManager("*")时打印出的链接异常和例外:

01-19-2018 00:36:02,581 ERROR [main] (MQConnection.java:60) - Caught JMSException
01-19-2018 00:36:02,581 ERROR [main] (MQConnection.java:61) - linked exceptions com.ibm.mq.MQException: JMSCMQ0001: WebSphere MQ call failed with compcode '2' ('MQCC_FAILED') reason '2059' ('MQRC_Q_MGR_NOT_AVAILABLE').
01-19-2018 00:36:02,581 ERROR [main] (MQConnection.java:66) - Exception Msg: JMSWMQ2020: Failed to connect to queue manager '*' with connection mode 'Client' and supplied CCDT URL 'file:/usr/dev/ccdt.tab', see linked exception for more information.
01-19-2018 00:36:02,581 ERROR [main] (MQConnection.java:70) - JMS Error code: JMSWMQ2020
01-19-2018 00:36:02,581 ERROR [main] (MQConnection.java:73) - JMS Explanation: null
01-19-2018 00:36:02,582 ERROR [main] (MQConnection.java:74) - JMS Explanation: 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.
01-19-2018 00:36:02,582 ERROR [main] (MQConnection.java:66) - Exception Msg: JMSCMQ0001: WebSphere MQ call failed with compcode '2' ('MQCC_FAILED') reason '2059' ('MQRC_Q_MGR_NOT_AVAILABLE').
01-19-2018 00:36:02,582 ERROR [main] (MQConnection.java:78) - WMQ Completion code: 2
01-19-2018 00:36:02,582 ERROR [main] (MQConnection.java:79) - WMQ Reason code: 2059
01-19-2018 00:36:02,583 ERROR [main] (MQConnection.java:66) - Exception Msg: CC=2;RC=2059;AMQ9204: Connection to host '' rejected. [1=com.ibm.mq.jmqi.JmqiException[CC=2;RC=2059;AMQ9213: A communications error for  occurred. [1=java.net.ConnectException[Connection refused],3=localhost]],3=,5=RemoteTCPConnection.connnectUsingLocalAddress]
01-19-2018 00:36:02,584 ERROR [main] (MQConnection.java:82) - WMQ Log Message: 1/19/18 12:36:02 AM - User(Rle) Program(java)
AMQ9204: Connection to host '' rejected.

EXPLANATION:
Connection to host '' over '?' was rejected.
ACTION:
The remote system may not be configured to allow connections from this host.
Check the '?' listener program has been started on host ''.
If the conversation uses LU 6.2, it is possible that either the User ID or
Password supplied to the remote host is incorrect.
If the conversation uses TCP/IP, it is possible that the remote host does not
recognize the local host as a valid host.
The return code from the '?''RemoteTCPConnection.connnectUsingLocalAddress'
call was 'com.ibm.mq.jmqi.JmqiException[CC=2;RC=2059;AMQ9213: A communications
error for occurred. [1=java.net.ConnectException[Connection
refused],3=localhost]]' X('?').
Record the error values and tell the systems administrator.
---- RemoteFAP.java : 2010 -----------------------------------------------------

01-19-2018 00:36:02,585 ERROR [main] (MQConnection.java:83) - WMQ Explanation: Connection to host '' over '?' was rejected.
01-19-2018 00:36:02,585 ERROR [main] (MQConnection.java:84) - WMQ Msg Summary: AMQ9204: Connection to host '' rejected.
01-19-2018 00:36:02,585 ERROR [main] (MQConnection.java:85) - WMQ Msg User Response: The remote system may not be configured to allow connections from this host. Check the '?' listener program has been started on host ''.
 If the conversation uses LU 6.2, it is possible that either the User ID or Password supplied to the remote host is incorrect.
 If the conversation uses TCP/IP, it is possible that the remote host does not recognize the local host as a valid host.
 The return code from the '?''RemoteTCPConnection.connnectUsingLocalAddress' call was 'com.ibm.mq.jmqi.JmqiException[CC=2;RC=2059;AMQ9213: A communications error for  occurred. [1=java.net.ConnectException[Connection refused],3=localhost]]' X('?').
 Record the error values and tell the systems administrator.
01-19-2018 00:36:02,585 ERROR [main] (MQConnection.java:87) - WMQ Msg Severity: 30
01-19-2018 00:36:02,586 ERROR [main] (MQConnection.java:66) - Exception Msg: CC=2;RC=2059;AMQ9213: A communications error for  occurred. [1=java.net.ConnectException[Connection refused],3=localhost]
01-19-2018 00:36:02,586 ERROR [main] (MQConnection.java:82) - WMQ Log Message: 1/19/18 12:36:02 AM - User(Rle) Program(java)
AMQ9213: A communications error for occurred.

EXPLANATION:
An unexpected error occurred in communications.
ACTION:
The return code from the call was 'java.net.ConnectException[Connection
refused]' (X'?'). Record these values and tell the systems administrator.
---- RemoteTCPConnection.java : 663 --------------------------------------------

01-19-2018 00:36:02,587 ERROR [main] (MQConnection.java:83) - WMQ Explanation: An unexpected error occurred in communications.
01-19-2018 00:36:02,587 ERROR [main] (MQConnection.java:84) - WMQ Msg Summary: AMQ9213: A communications error for  occurred.
01-19-2018 00:36:02,587 ERROR [main] (MQConnection.java:85) - WMQ Msg User Response: The return code from the  call was 'java.net.ConnectException[Connection refused]' (X'?'). Record these values and tell the systems administrator.
01-19-2018 00:36:02,587 ERROR [main] (MQConnection.java:87) - WMQ Msg Severity: 30
01-19-2018 00:36:02,587 ERROR [main] (MQConnection.java:66) - Exception Msg: Connection refused

以下是我setQueueManager("QQ")时打印出的链接异常和例外:

01-19-2018 16:58:18,825 ERROR [main] (MQConnection.java:60) - Caught JMSException
01-19-2018 16:58:18,825 ERROR [main] (MQConnection.java:61) - linked exceptions com.ibm.mq.MQException: JMSCMQ0001: WebSphere MQ call failed with compcode '2' ('MQCC_FAILED') reason '2058' ('MQRC_Q_MGR_NAME_ERROR').
01-19-2018 16:58:18,825 ERROR [main] (MQConnection.java:66) - Exception Msg: JMSWMQ2020: Failed to connect to queue manager 'QQ' with connection mode 'Client' and supplied CCDT URL'file:/usr/dev/ccdt.tab', see linked exception for more information.
01-19-2018 16:58:18,825 ERROR [main] (MQConnection.java:70) - JMS Error code: JMSWMQ2020
01-19-2018 16:58:18,825 ERROR [main] (MQConnection.java:73) - JMS Explanation: null
01-19-2018 16:58:18,825 ERROR [main] (MQConnection.java:74) - JMS Explanation: 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.
01-19-2018 16:58:18,826 ERROR [main] (MQConnection.java:66) - Exception Msg: JMSCMQ0001: WebSphere MQ call failed with compcode '2' ('MQCC_FAILED') reason '2058' ('MQRC_Q_MGR_NAME_ERROR').
01-19-2018 16:58:18,826 ERROR [main] (MQConnection.java:78) - WMQ Completion code: 2
01-19-2018 16:58:18,826 ERROR [main] (MQConnection.java:79) - WMQ Reason code: 2058
01-19-2018 16:58:18,830 ERROR [main] (MQConnection.java:66) - Exception Msg: CC=2;RC=2059;AMQ9204: Connection to host 'host1.test.com(1511)' rejected. [3=host1.test.com(1511)]
01-19-2018 16:58:18,831 ERROR [main] (MQConnection.java:82) - WMQ Log Message: 1/19/18 4:58:18 PM - User(Rle) Program(java)
AMQ9204: Connection to host 'host1.test.com(1511)' rejected.

EXPLANATION:
Connection to host 'host1.test.com(1511)' over '?' was rejected.
ACTION:
The remote system may not be configured to allow connections from this host.
Check the '?' listener program has been started on host
'host1.test.com(1511)'.
If the conversation uses LU 6.2, it is possible that either the User ID or
Password supplied to the remote host is incorrect.
If the conversation uses TCP/IP, it is possible that the remote host does not
recognize the local host as a valid host.
The return code from the '?''?' call was '?' X('?').
Record the error values and tell the systems administrator.
---- RemoteFAP.java : 1980 -----------------------------------------------------

01-19-2018 16:58:18,831 ERROR [main] (MQConnection.java:83) - WMQ Explanation: Connection to host 'host1.test.com(1511)' over '?' was rejected.
01-19-2018 16:58:18,831 ERROR [main] (MQConnection.java:84) - WMQ Msg Summary: AMQ9204: Connection to host 'host1.test.com(1511)' rejected.
01-19-2018 16:58:18,831 ERROR [main] (MQConnection.java:85) - WMQ Msg User Response: The remote system may not be configured to allow connections from this host. Check the '?' listener program has been started on host 'host1.test.com(1511)'.
 If the conversation uses LU 6.2, it is possible that either the User ID or Password supplied to the remote host is incorrect.
 If the conversation uses TCP/IP, it is possible that the remote host does not recognize the local host as a valid host.
 The return code from the '?''?' call was '?' X('?').
 Record the error values and tell the systems administrator.
01-19-2018 16:58:18,831 ERROR [main] (MQConnection.java:87) - WMQ Msg Severity: 30

谢谢!

1 个答案:

答案 0 :(得分:1)

指定setQueueManager("*")时,错误为:

AMQ9204: Connection to host '' rejected.

这是因为IBM MQ可以解析CCDT中的两个通道中的任何一个。通道C.TEST.2没有CONNAME所以当MQ选择通道时会导致上述错误。如果您尝试连接多次,如果它选择了频道C.TEST.1,则可能会成功一些。

指定setQueueManager("QQ")时,错误为:

JMSCMQ0001: WebSphere MQ call failed with compcode '2' ('MQCC_FAILED') reason '2058' ('MQRC_Q_MGR_NAME_ERROR').

这是因为远程队列管理器名称不是QQ

您有两种方法可以解决此问题:

  1. 使用setQueueManager("*QQ"),这将导致MQ使用QQ通道,但使用前导*,它将允许您连接到侦听主机的任何队列管理器和CONNAME

  2. 中指定的端口
  3. 如果需要,您也可以使用setQueueManager("*")但是您需要使用MQ v8或更高版本runmqsc来编辑CCDT并删除第二个频道DELETE CHL(C.TEST.2)。通过执行此操作,*只能解析为剩下的单个通道QQ,并且还允许您连接到侦听{{1}中指定的主机和端口的任何队列管理器}