1
votes

I'm trying to send a message to IBM MQ (Version: 9.0.0.0), code bellow.
* I have tried with\without the userid and password. When I try the same code with IBM MQ installed on my machine (localhost) it works smoothly.

private static void foo() throws JMSException {
        Request request = new Request();
        request.setRequestKey("11-12347");
        request.setQueryString("This is a query string!");

        MQQueueConnectionFactory cf = new MQQueueConnectionFactory();
        cf.setHostName("192.168.1.107");
        cf.setPort(1414);
        cf.setAppName("WMQ Tester");
//        cf.createConnection(sccsid, sccsid)
        cf.setIntProperty(WMQConstants.WMQ_CONNECTION_MODE, WMQConstants.WMQ_CM_CLIENT);
        cf.setQueueManager("SanctionManager");
        cf.setChannel("system.def.sanction");

        MQQueueConnection connection = (MQQueueConnection) cf.createQueueConnection("hanash", "hanash1");
        MQQueueSession session = (MQQueueSession) connection.createQueueSession(true, Session.AUTO_ACKNOWLEDGE);

        MQQueue queue = (MQQueue) session.createQueue("queue:///SanctionQueue");
        MQQueueSender sender = (MQQueueSender) session.createSender(queue);

        ObjectMessage objectMessage = session.createObjectMessage(request);
        connection.start();
        sender.send(objectMessage);
        session.commit();

    }

This gives the following exception:

Exception in thread "main" com.ibm.msg.client.jms.DetailedJMSException: JMSWMQ0018: Failed to connect to queue manager 'SanctionManager' with connection mode 'Client' and host name '192.168.1.107(1414)'.
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.
    at com.ibm.msg.client.wmq.common.internal.Reason.reasonToException(Reason.java:595)
    at com.ibm.msg.client.wmq.common.internal.Reason.createException(Reason.java:215)
    at com.ibm.msg.client.wmq.internal.WMQConnection.<init>(WMQConnection.java:422)
    at com.ibm.msg.client.wmq.factories.WMQConnectionFactory.createV7ProviderConnection(WMQConnectionFactory.java:8475)
    at com.ibm.msg.client.wmq.factories.WMQConnectionFactory.createProviderConnection(WMQConnectionFactory.java:7814)
    at com.ibm.msg.client.jms.admin.JmsConnectionFactoryImpl._createConnection(JmsConnectionFactoryImpl.java:299)
    at com.ibm.msg.client.jms.admin.JmsConnectionFactoryImpl.createConnection(JmsConnectionFactoryImpl.java:236)
    at com.ibm.mq.jms.MQConnectionFactory.createCommonConnection(MQConnectionFactory.java:6024)
    at com.ibm.mq.jms.MQQueueConnectionFactory.createQueueConnection(MQQueueConnectionFactory.java:136)
    at com.dgbi.cre.MQSample.foo(MQSample.java:135)
    at com.dgbi.cre.MQSample.main(MQSample.java:63)
Caused by: com.ibm.mq.MQException: JMSCMQ0001: IBM MQ call failed with compcode '2' ('MQCC_FAILED') reason '2195' ('MQRC_UNEXPECTED_ERROR').
    at com.ibm.msg.client.wmq.common.internal.Reason.createException(Reason.java:203)
    ... 9 more
Caused by: com.ibm.mq.jmqi.JmqiException: CC=2;RC=2195;AMQ9204: Connection to host '192.168.1.107(1414)' rejected. [1=com.ibm.mq.jmqi.JmqiException[CC=2;RC=2195;AMQ6047: Conversion not supported. [1=720,5=???]],3=192.168.1.107(1414),5=RemoteConnection.initSess]
    at com.ibm.mq.jmqi.remote.api.RemoteFAP.jmqiConnect(RemoteFAP.java:2280)
    at com.ibm.mq.jmqi.remote.api.RemoteFAP.jmqiConnect(RemoteFAP.java:1285)
    at com.ibm.mq.ese.jmqi.InterceptedJmqiImpl.jmqiConnect(InterceptedJmqiImpl.java:376)
    at com.ibm.mq.ese.jmqi.ESEJMQI.jmqiConnect(ESEJMQI.java:563)
    at com.ibm.msg.client.wmq.internal.WMQConnection.<init>(WMQConnection.java:355)
    ... 8 more
Caused by: com.ibm.mq.jmqi.JmqiException: CC=2;RC=2195;AMQ6047: Conversion not supported. [1=720,5=???]
    at com.ibm.mq.jmqi.remote.impl.RemoteConnection.initSess(RemoteConnection.java:1282)
    at com.ibm.mq.jmqi.remote.impl.RemoteConnection.connect(RemoteConnection.java:863)
    at com.ibm.mq.jmqi.remote.impl.RemoteConnectionSpecification.getSessionFromNewConnection(RemoteConnectionSpecification.java:409)
    at com.ibm.mq.jmqi.remote.impl.RemoteConnectionSpecification.getSession(RemoteConnectionSpecification.java:305)
    at com.ibm.mq.jmqi.remote.impl.RemoteConnectionPool.getSession(RemoteConnectionPool.java:146)
    at com.ibm.mq.jmqi.remote.api.RemoteFAP.jmqiConnect(RemoteFAP.java:1721)
    ... 12 more
Caused by: java.io.UnsupportedEncodingException: 720
    at com.ibm.mq.jmqi.remote.impl.RemoteConnection.initSess(RemoteConnection.java:1268)
    ... 17 more

What does this exception mean? and how can I solve it?

2

2 Answers

2
votes

The key errors in the exception is:

Caused by: com.ibm.mq.jmqi.JmqiException: CC=2;RC=2195;AMQ6047: Conversion not supported. [1=720,5=???]
Caused by: java.io.UnsupportedEncodingException: 720

It appears this is a known issue in IBM MQ v9.0.0.0 documented in the following APAR:

IT17154: Java client fails to connect to z/OS with exception 'AMQ6047: conversion not supported' in a non-IBM Java runtime

This APAR was fixed in 9.0.0.1. I would suggest you go with 9.0.0.3 which is the current LTS (Long Term Support) version.

If you review the APAR and compare to your issue the difference is that you are connecting to a remote queue manager that is set with CCSID 720 (MSDOS ARABIC). The problem is that the Java JRE you are using does not support this CCSID and due to a defect the client does not attempt to renegotiate the CCSID to one supported by the JRE and the connection fails with the 2195 error.

0
votes

From JoshMC answer, after reading:
IT17154: Java client fails to connect to z/OS with exception 'AMQ6047: conversion not supported' in a non-IBM Java runtime

One way to solve the issue is to use IBM Java version to build the application. (which I actually did.)