Reputation: 486
I'm trying to connect to queue manager using ccdt.tab file. Here is what I tried:
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();
Here is what inside of my 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( )
However, I did get the error on queue connection: Exception in thread "main" java.lang.Exception: JMSWMQ2020: Failed to connect to queue manager '*' with connection mode 'Client' and supplied CCDT URL 'file:/use/test/ccdt.tab', see linked exception for more information.
I tried to change to: setQueueManager("*QUEMANAGER")
or setQueueManager("*")
or setQueueManager("QMGRNAME")
It returned same error. I also check ssl connection, it runs fine.
Also, I tried to connect to MQ server using this code and it works perfectly fine:
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();
Does anyone know what went wrong and how to fix it?
ps: I did saw those posts: Connecting to IBM MQ using CCDT file in JMS
http://javarevisited.blogspot.com/2015/03/webshpere-mq-ssl-errors-java-solution.html#axzz54Zzodg6t
Here is the linked exception and exception print out when I 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
Here is the linked exception and exception print out when I 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
Upvotes: 2
Views: 7176
Reputation: 10652
When you specify setQueueManager("*")
the error is:
AMQ9204: Connection to host '' rejected.
This is because IBM MQ can resolve either of the two channels in your CCDT. The channel C.TEST.2
has no CONNAME
so when MQ selects the channel it causes the above error. If you tried to connect multiple times you may succeed some times if it picks the channel C.TEST.1
.
When you specify setQueueManager("QQ")
the error is:
JMSCMQ0001: WebSphere MQ call failed with compcode '2' ('MQCC_FAILED') reason '2058' ('MQRC_Q_MGR_NAME_ERROR').
This because the remote queue manager name is not QQ
.
You have two options to resolve this issue:
Use setQueueManager("*QQ")
, this will cause MQ to use the QQ
channel, but with the leading *
it will allow you to connect to any queue manager listening on the host and port specified in the CONNAME
You could also use setQueueManager("*")
if you want but you would need to use MQ v8 or higher runmqsc
to edit the CCDT and deleted the second channel DELETE CHL(C.TEST.2)
. By doing this, the *
can only resolve to the single channel QQ
that is left, and also will allow you to connect to any queue manager listening on the host and port specified in the CONNAME
Upvotes: 1