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

JMSWMQ2020: Failed to connect to queue manager

我正在尝试使用 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 'file:/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:我确实看到了那些帖子:

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

当您指定 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,并且还允许您连接到侦听 [=14= 中指定的主机和端口的任何队列管理器]