Kasun
Kasun

Reputation: 307

Websphere Mq Connection error

When I run the following program it give me the jms.DetailedJMSException: JMSWMQ2020: Failed to connect to queue manager '' with connection mode 'Client' and supplied CCDT URL. Can somebody please help me to run this program..

        MQQueueConnectionFactory cf = new MQQueueConnectionFactory();

        // Config
        cf.setHostName("192.163.1.173");
        cf.setPort(1414);
        cf.setTransportType( JMSC.MQJMS_TP_CLIENT_MQ_TCPIP);
        cf.setQueueManager("TEST");
        cf.setChannel("SYSTEM.DEF.SVRCONN");

        MQQueueConnection connection = (MQQueueConnection) cf.createQueueConnection("mgm","mgm321");
        MQQueueSession session = (MQQueueSession) connection.createQueueSession(false, Session.AUTO_ACKNOWLEDGE);
        MQQueue queue = (MQQueue) session.createQueue("queue:///QUEUE4");
        MQQueueSender sender =  (MQQueueSender) session.createSender(queue);
        MQQueueReceiver receiver = (MQQueueReceiver) session.createReceiver(queue);

        long uniqueNumber = System.currentTimeMillis() % 1000;
        JMSTextMessage message = (JMSTextMessage) session.createTextMessage("SimplePTP "+ uniqueNumber);

        // Start the connection
        connection.start();

        sender.send(message);
        System.out.println("Sent message:\\n" + message);

        JMSMessage receivedMessage = (JMSMessage) receiver.receive(10000);
        System.out.println("\\nReceived message:\\n" + receivedMessage);

        sender.close();
        receiver.close();
        session.close();
        connection.close();

This is the stack trace of the error..

com.ibm.msg.client.jms.DetailedJMSException: JMSWMQ2020: Failed to connect to queue manager '' with connection mode 'Client' and supplied CCDT URL 'http://192.168.1.173', see linked exception for more information.
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:578)
    at com.ibm.msg.client.wmq.common.internal.Reason.createException(Reason.java:214)
    at com.ibm.msg.client.wmq.internal.WMQConnection.<init>(WMQConnection.java:408)
    at com.ibm.msg.client.wmq.factories.WMQConnectionFactory.createV7ProviderConnection(WMQConnectionFactory.java:6398)
    at com.ibm.msg.client.wmq.factories.WMQConnectionFactory.createProviderConnection(WMQConnectionFactory.java:5740)
    at com.ibm.msg.client.jms.admin.JmsConnectionFactoryImpl._createConnection(JmsConnectionFactoryImpl.java:293)
    at com.ibm.msg.client.jms.admin.JmsConnectionFactoryImpl.createConnection(JmsConnectionFactoryImpl.java:234)
    at com.ibm.mq.jms.MQConnectionFactory.createCommonConnection(MQConnectionFactory.java:6016)
    at com.ibm.mq.jms.MQConnectionFactory.createConnection(MQConnectionFactory.java:6065)
    at IBMMessageSender.<init>(IBMMessageSender.java:32)
    at IBMMessageSender.main(IBMMessageSender.java:21)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:483)
    at com.intellij.rt.execution.application.AppMain.main(AppMain.java:140)
Caused by: com.ibm.mq.MQException: JMSCMQ0001: WebSphere MQ call failed with compcode '2' ('MQCC_FAILED') reason '2278' ('MQRC_CLIENT_CONN_ERROR').
    at com.ibm.msg.client.wmq.common.internal.Reason.createException(Reason.java:202)
    ... 14 more
Caused by: com.ibm.mq.jmqi.JmqiException: CC=2;RC=2278;AMQ9516: File error occurred. [1=java.io.IOException[Server returned HTTP response code: 403 for URL: http://192.168.1.173],3=http://192.168.1.173]
    at com.ibm.mq.jmqi.system.internal.CCDT.parse(CCDT.java:344)
    at com.ibm.mq.jmqi.system.internal.CCDT.<init>(CCDT.java:210)
    at com.ibm.mq.jmqi.remote.impl.RemoteCCDT.<init>(RemoteCCDT.java:75)
    at com.ibm.mq.jmqi.remote.api.RemoteFAP.getCcdt(RemoteFAP.java:512)
    at com.ibm.mq.jmqi.remote.api.RemoteFAP.jmqiConnect(RemoteFAP.java:1623)
    at com.ibm.mq.jmqi.remote.api.RemoteFAP.jmqiConnect(RemoteFAP.java:1287)
    at com.ibm.mq.ese.jmqi.InterceptedJmqiImpl.jmqiConnect(InterceptedJmqiImpl.java:376)
    at com.ibm.mq.ese.jmqi.ESEJMQI.jmqiConnect(ESEJMQI.java:560)
    at com.ibm.msg.client.wmq.internal.WMQConnection.<init>(WMQConnection.java:344)
    ... 13 more
Caused by: java.io.IOException: Server returned HTTP response code: 403 for URL: http://192.168.1.173
    at sun.net.www.protocol.http.HttpURLConnection.getInputStream0(HttpURLConnection.java:1839)
    at sun.net.www.protocol.http.HttpURLConnection.getInputStream(HttpURLConnection.java:1440)
    at java.net.URL.openStream(URL.java:1038)
    at com.ibm.mq.jmqi.system.internal.CCDT$2.run(CCDT.java:313)
    at java.security.AccessController.doPrivileged(Native Method)
    at com.ibm.mq.jmqi.system.internal.CCDT.parse(CCDT.java:305)
    ... 21 more

Upvotes: 2

Views: 3074

Answers (1)

Attila Repasi
Attila Repasi

Reputation: 1830

The CCDT (Client Channel Definition Table) is a file that defines the properties of the MQ client connection. So this CCDT URL should reference this file.

Looking at your code it seems that you want to use JMS, so you are defining the connection properties on the JMS connection factory, in which case you don't need to set the CCDT URL.

But your JMS properties don't seem right either. You can find sample code under the MQ installation, e.g. C:\Program Files (x86)\IBM\WebSphere MQ\tools\jms\samples\JMSProducer.java

Upvotes: 1

Related Questions