MQ: Connection to host rejected | Channel negotiation failed

EN20

Hello I have one big problem with connecting to IBM WebSphere MQ using JMS
I use:

  • Win 7
  • JDK 1.7
  • IBM WebSphere MQ server 7.5.0.2
  • GlassFish 4.0

I make one QueueManager named test1 and one queue in that named test1q and one channel for negotiation named test1channel

My code is here:

StandaloneSender s = new StandaloneSender();
try{
    s.send(“hello word”);
}catch (Exception e){
    e.printStackTrace();
}

StandaloneSender.java

import javax.jms.Message;
import javax.jms.QueueConnection;
import javax.jms.QueueSender;
import javax.jms.QueueSession;
import javax.jms.Session;
import javax.naming.NamingException;

public class StandaloneSender {
    private P2PUtils utils;
    private QueueConnection connection;
    private QueueSession session;
    private QueueSender sender;
    public void send(String message) throws NamingException, JMSException, IOException {
        StandaloneSender sender = new StandaloneSender();
        sender.connect();
        sender.sendMessage(message);
        sender.disconnect();
    }

    public StandaloneSender() {
        utils = new P2PUtils();
    }

    private void connect() throws NamingException, JMSException {
        connection = utils.getConnection();
        session =
            connection.createQueueSession(false, Session.AUTO_ACKNOWLEDGE);
        sender = session.createSender(utils.getQueue());
        System.out.println("Sender started.");
    }

    private void sendMessage(String text) throws JMSException {
        Message message = session.createTextMessage(text);
        sender.send(message);
        System.out.println(
            "Sent message <"
                + text
                + "> with ID <"
                + message.getJMSMessageID()
                + ">");
    }
    private void disconnect() throws JMSException {
        sender.close();
        session.close();
        connection.close();
        System.out.println("Sender stopped.");
    }
}

P2PUtils.java

import javax.jms.JMSException;
import javax.jms.Queue;
import javax.jms.QueueConnection;
import javax.jms.QueueConnectionFactory;
import javax.naming.Context;
import javax.naming.NamingException;

public class P2PUtils extends JmsUtils {

    private static final String QCF_NAME = "test1";
    private static final String QUEUE_NAME = "test1q";

    public QueueConnection getConnection() throws NamingException, JMSException {
        Context context = getInitialContext();
        QueueConnectionFactory qcf =
            (QueueConnectionFactory) context.lookup(QCF_NAME);
        return qcf.createQueueConnection();
    }

    public Queue getQueue() throws NamingException {
        Context context = getInitialContext();
        return (Queue) context.lookup(QUEUE_NAME);
    }
}

JmsUtils.java

import java.util.Properties;

import javax.naming.Context;
import javax.naming.InitialContext;
import javax.naming.NamingException;

public class JmsUtils {
    private static final String CF_CLASS_NAME = "com.ibm.mq.jms.context.WMQInitialContextFactory";
    private static final String WMQ_URL = "localhost:1414/SYSTEM.DEF.SVRCONN";

    protected Context getInitialContext() throws NamingException {
        Properties props = new Properties();
        props.put(Context.INITIAL_CONTEXT_FACTORY, CF_CLASS_NAME);
        props.put(Context.PROVIDER_URL, WMQ_URL);
        return new InitialContext(props);
    }
}

But I have got this exception from glassfish:

[2014-02-17T16:35:25.286+0330] [glassfish 4.0] [SEVERE] [] [] [tid: _ThreadID=25 _ThreadName=Thread-4] [timeMillis: 1392642325286] [levelValue: 1000] [[
  javax.naming.ServiceUnavailableException: Unable to connect to the target queue manager localhost:1414/SYSTEM.DEF.SVRCONN [Root exception is com.ibm.mq.MQException: MQJE001: Completion Code '2', Reason '2539'.]
    at com.ibm.mq.jms.context.MQContext.<init>(MQContext.java:196)
    at com.ibm.mq.jms.context.WMQInitialContextFactory.getInitialContext(WMQInitialContextFactory.java:29)
    at javax.naming.spi.NamingManager.getInitialContext(NamingManager.java:684)
    at javax.naming.InitialContext.getDefaultInitCtx(InitialContext.java:307)
    at javax.naming.InitialContext.init(InitialContext.java:242)
    at javax.naming.InitialContext.<init>(InitialContext.java:216)
    at com.surena.MQ.JmsUtils.getInitialContext(JmsUtils.java:17)
    at com.surena.MQ.P2PUtils.getConnection(P2PUtils.java:16)
    at com.surena.MQ.StandaloneSender.connect(StandaloneSender.java:32)
    at com.surena.MQ.StandaloneSender.send(StandaloneSender.java:22)
    at com.surena.servlet.MainServlet.doGet(MainServlet.java:50)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:687)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:790)
    at org.apache.catalina.core.StandardWrapper.service(StandardWrapper.java:1682)
    at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:318)
    at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:160)
    at org.apache.catalina.core.StandardPipeline.doInvoke(StandardPipeline.java:734)
    at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:673)
    at com.sun.enterprise.web.WebPipeline.invoke(WebPipeline.java:99)
    at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:174)
    at org.apache.catalina.connector.CoyoteAdapter.doService(CoyoteAdapter.java:357)
    at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:260)
    at com.sun.enterprise.v3.services.impl.ContainerMapper.service(ContainerMapper.java:188)
    at org.glassfish.grizzly.http.server.HttpHandler.runService(HttpHandler.java:191)
    at org.glassfish.grizzly.http.server.HttpHandler.doHandle(HttpHandler.java:168)
    at org.glassfish.grizzly.http.server.HttpServerFilter.handleRead(HttpServerFilter.java:189)
    at org.glassfish.grizzly.filterchain.ExecutorResolver$9.execute(ExecutorResolver.java:119)
    at org.glassfish.grizzly.filterchain.DefaultFilterChain.executeFilter(DefaultFilterChain.java:288)
    at org.glassfish.grizzly.filterchain.DefaultFilterChain.executeChainPart(DefaultFilterChain.java:206)
    at org.glassfish.grizzly.filterchain.DefaultFilterChain.execute(DefaultFilterChain.java:136)
    at org.glassfish.grizzly.filterchain.DefaultFilterChain.process(DefaultFilterChain.java:114)
    at org.glassfish.grizzly.ProcessorExecutor.execute(ProcessorExecutor.java:77)
    at org.glassfish.grizzly.nio.transport.TCPNIOTransport.fireIOEvent(TCPNIOTransport.java:838)
    at org.glassfish.grizzly.strategies.AbstractIOStrategy.fireIOEvent(AbstractIOStrategy.java:113)
    at org.glassfish.grizzly.strategies.WorkerThreadIOStrategy.run0(WorkerThreadIOStrategy.java:115)
    at org.glassfish.grizzly.strategies.WorkerThreadIOStrategy.access$100(WorkerThreadIOStrategy.java:55)
    at org.glassfish.grizzly.strategies.WorkerThreadIOStrategy$WorkerThreadRunnable.run(WorkerThreadIOStrategy.java:135)
    at org.glassfish.grizzly.threadpool.AbstractThreadPool$Worker.doWork(AbstractThreadPool.java:564)
    at org.glassfish.grizzly.threadpool.AbstractThreadPool$Worker.run(AbstractThreadPool.java:544)
    at java.lang.Thread.run(Thread.java:744)
Caused by: com.ibm.mq.MQException: MQJE001: Completion Code '2', Reason '2539'.
    at com.ibm.mq.MQManagedConnectionJ11.<init>(MQManagedConnectionJ11.java:247)
    at com.ibm.mq.MQClientManagedConnectionFactoryJ11._createManagedConnection(MQClientManagedConnectionFactoryJ11.java:588)
    at com.ibm.mq.MQClientManagedConnectionFactoryJ11.createManagedConnection(MQClientManagedConnectionFactoryJ11.java:630)
    at com.ibm.mq.StoredManagedConnection.<init>(StoredManagedConnection.java:107)
    at com.ibm.mq.MQSimpleConnectionManager.allocateConnection(MQSimpleConnectionManager.java:205)
    at com.ibm.mq.MQQueueManagerFactory.obtainBaseMQQueueManager(MQQueueManagerFactory.java:911)
    at com.ibm.mq.MQQueueManagerFactory.procure(MQQueueManagerFactory.java:799)
    at com.ibm.mq.MQQueueManagerFactory.constructQueueManager(MQQueueManagerFactory.java:750)
    at com.ibm.mq.MQQueueManagerFactory.createQueueManager(MQQueueManagerFactory.java:157)
    at com.ibm.mq.MQQueueManager.<init>(MQQueueManager.java:757)
    at com.ibm.mq.pcf.PCFAgent.connect(PCFAgent.java:230)
    at com.ibm.mq.pcf.PCFAgent.<init>(PCFAgent.java:163)
    at com.ibm.mq.pcf.PCFMessageAgent.<init>(PCFMessageAgent.java:140)
    at com.ibm.mq.jms.context.MQContext.<init>(MQContext.java:183)
    ... 39 more
Caused by: com.ibm.mq.jmqi.JmqiException: CC=2;RC=2539;AMQ9204: Connection to host 'localhost(1414)' rejected. [1=com.ibm.mq.jmqi.JmqiException[CC=2;RC=2539;AMQ9503: Channel negotiation failed. [3=SYSTEM.DEF.SVRCONN]],3=localhost(1414),5=RemoteConnection.initSess]
    at com.ibm.mq.jmqi.remote.api.RemoteFAP.jmqiConnect(RemoteFAP.java:2053)
    at com.ibm.mq.jmqi.remote.api.RemoteFAP.jmqiConnect(RemoteFAP.java:1226)
    at com.ibm.mq.ese.jmqi.InterceptedJmqiImpl.jmqiConnect(InterceptedJmqiImpl.java:311)
    at com.ibm.mq.ese.jmqi.ESEJMQI.jmqiConnect(ESEJMQI.java:337)
    at com.ibm.mq.MQSESSION.MQCONNX_j(MQSESSION.java:924)
    at com.ibm.mq.MQManagedConnectionJ11.<init>(MQManagedConnectionJ11.java:236)
    ... 52 more
Caused by: com.ibm.mq.jmqi.JmqiException: CC=2;RC=2539;AMQ9503: Channel negotiation failed. [3=SYSTEM.DEF.SVRCONN]
    at com.ibm.mq.jmqi.remote.impl.RemoteConnection.initSess(RemoteConnection.java:1111)
    at com.ibm.mq.jmqi.remote.impl.RemoteConnection.connect(RemoteConnection.java:727)
    at com.ibm.mq.jmqi.remote.impl.RemoteConnectionSpecification.getSessionFromNewConnection(RemoteConnectionSpecification.java:400)
    at com.ibm.mq.jmqi.remote.impl.RemoteConnectionSpecification.getSession(RemoteConnectionSpecification.java:299)
    at com.ibm.mq.jmqi.remote.impl.RemoteConnectionPool.getSession(RemoteConnectionPool.java:164)
    at com.ibm.mq.jmqi.remote.api.RemoteFAP.jmqiConnect(RemoteFAP.java:1598)
    ... 57 more]]

And this from IBM MQ

2/17/2014 14:41:51 - Process(3924.1) User(MUSR_MQADMIN) Program(runmqlsr.exe)
                      Host(PROGRAMMER1) Installation(Installation1)
                      VRMF(7.5.0.2)
AMQ6118: An internal WebSphere MQ error has occurred (20006047)

EXPLANATION:
An error has been detected, and the MQ error recording routine has been called.
ACTION:
Use the standard facilities supplied with your system to record the problem
identifier and to save any generated output files. Use either the MQ Support
site: http://www.ibm.com/software/integration/wmq/support/, or IBM Support
Assistant (ISA): http://www.ibm.com/software/support/isa/, to see whether a
solution is already available.  If you are unable to find a match, contact your
IBM support center.  Do not discard these files until the problem has been
resolved. 
----- amqxfdcp.c : 867 --------------------------------------------------------
2/17/2014 14:41:51 - Process(3924.1) User(MUSR_MQADMIN) Program(runmqlsr.exe)
                      Host(PROGRAMMER1) Installation(Installation1)
                      VRMF(7.5.0.2)
AMQ6184: An internal WebSphere MQ error has occurred on queue manager test1    
                                      .

EXPLANATION:
An error has been detected, and the WebSphere MQ error recording routine has
been called. The failing process is process 3924.
ACTION:
Use the standard facilities supplied with your system to record the problem
identifier and to save any generated output files. Use either the MQ Support
site: http://www.ibm.com/software/integration/wmq/support/, or IBM Support
Assistant (ISA): http://www.ibm.com/software/support/isa/, to see whether a
solution is already available.  If you are unable to find a match, contact your
IBM support center.  Do not discard these files until the problem has been
resolved.

I used all jar file that included in MQ installation directory
please help me.

Morag Hughson

From your exception from glassfish I've picked out the interesting bits:-

javax.naming.ServiceUnavailableException: Unable to connect to the target
queue manager localhost:1414/SYSTEM.DEF.SVRCONN [Root exception is
com.ibm.mq.MQException: MQJE001: Completion Code '2', Reason '2539'.


Caused by: com.ibm.mq.jmqi.JmqiException: CC=2;RC=2539;
AMQ9204: Connection to host 'localhost(1414)' rejected.
[1=com.ibm.mq.jmqi.JmqiException[CC=2;RC=2539;
AMQ9503: Channel negotiation failed. [3=SYSTEM.DEF.SVRCONN]],
3=localhost(1414),5=RemoteConnection.initSess]

Caused by: com.ibm.mq.jmqi.JmqiException: CC=2;RC=2539;
AMQ9503: Channel negotiation failed. [3=SYSTEM.DEF.SVRCONN]

There are various hints here for you. The first is the MQRC return code 2539. You can look this up using the mqrc command line tool that comes with IBM MQ. Just type mqrc 2539 and it will report:-

2539  0x000009eb  MQRC_CHANNEL_CONFIG_ERROR.

Also we have a couple of error messages:-

AMQ9204: Connection to host 'localhost(1414)' rejected.
AMQ9503: Channel negotiation failed. [3=SYSTEM.DEF.SVRCONN]

You can see the full error message description using the mqrc tool as well, just type mqrc AMQ9204. So we're getting the idea here that your network connection (channel) was not working right and the queue manager didn't like it for some reason. The next thing is to see what the queue manager had to say about it, as you did. In you error log you say you saw:-

2/17/2014 14:41:51 - Process(3924.1) User(MUSR_MQADMIN) Program(runmqlsr.exe)
                      Host(PROGRAMMER1) Installation(Installation1)
                      VRMF(7.5.0.2)
AMQ6118: An internal WebSphere MQ error has occurred (20006047)

Now this is indicating that there is likely an FDC file that has been cut as well which will give more details, but there is also another error code that you can look up, again with the mqrc tool. Type in mqrc 0x20006047 and it will report:-

536895559  0x20006047. xecX_E_CONV_NOT_SUP

This suggests that it was unable to cope with data conversion between your client and the queue manager. The FDC file will give you more details.

Collected from the Internet

Please contact [email protected] to delete if infringement.

edited at
0

Comments

0 comments
Login to comment

Related

From Dev

Error -- KIO Client Could not connect to host ... SSL negotiation failed

From Dev

500 SSL negotiation failed

From Dev

ssh algorithm negotiation failed

From Dev

Fix SSL negotiation failed

From Dev

channel 3: open failed: connect failed: Connection refused

From Dev

Flamerobin connection failed with Firebird 3.0 in Ubuntu 16.04 LTS - Error: connection rejected by remote interface

From Dev

could not open connection to the host, on port 5887: connection failed

From Dev

check chlauth for a MQ channel

From Dev

SSH -L connection successful, but localhost port forwarding not working "channel 3: open failed: connect failed: Connection refused"

From Dev

VNC via SSH tunnel: channel 3: open failed: connect failed: No route to host

From Dev

SSH connection problem with "Host key verification failed..." error

From Dev

SSH connection problem with "Host key verification failed..." error

From Dev

Telnet: Could not open connection to the host on port 23 : connect failed

From Dev

ssh tunnel error : channel 3: open failed: connect failed: Connection refused

From Dev

SQLDeveloper SSH Connection Algorithm negotiation fail

From Dev

android signalR hubconnection application negotiation failed with server

From Dev

LWP::UserAgent and 500 SSL negotiation failed

From Dev

The Security Support Provider Interface (SSPI) negotiation failed

From Dev

OpenVPN - TLS key negotiation failed on Raspbian

From Dev

Algorithm Negotiation failed when trying to connect to server

From Dev

android signalR hubconnection application negotiation failed with server

From Dev

Channel attributes to provide barriers in MQ

From Dev

Apache connection time out or rejected

From Dev

WAS MQ put by JmsConnectionFactory host unreachable

From Dev

WAS MQ put by JmsConnectionFactory host unreachable

From Dev

"Channel shutdown: connection error"

From Dev

Blackscreen - failed to idle channel

From Dev

MQ right way to close connection

From Dev

WebSphere MQ connection pooling with Tomcat

Related Related

  1. 1

    Error -- KIO Client Could not connect to host ... SSL negotiation failed

  2. 2

    500 SSL negotiation failed

  3. 3

    ssh algorithm negotiation failed

  4. 4

    Fix SSL negotiation failed

  5. 5

    channel 3: open failed: connect failed: Connection refused

  6. 6

    Flamerobin connection failed with Firebird 3.0 in Ubuntu 16.04 LTS - Error: connection rejected by remote interface

  7. 7

    could not open connection to the host, on port 5887: connection failed

  8. 8

    check chlauth for a MQ channel

  9. 9

    SSH -L connection successful, but localhost port forwarding not working "channel 3: open failed: connect failed: Connection refused"

  10. 10

    VNC via SSH tunnel: channel 3: open failed: connect failed: No route to host

  11. 11

    SSH connection problem with "Host key verification failed..." error

  12. 12

    SSH connection problem with "Host key verification failed..." error

  13. 13

    Telnet: Could not open connection to the host on port 23 : connect failed

  14. 14

    ssh tunnel error : channel 3: open failed: connect failed: Connection refused

  15. 15

    SQLDeveloper SSH Connection Algorithm negotiation fail

  16. 16

    android signalR hubconnection application negotiation failed with server

  17. 17

    LWP::UserAgent and 500 SSL negotiation failed

  18. 18

    The Security Support Provider Interface (SSPI) negotiation failed

  19. 19

    OpenVPN - TLS key negotiation failed on Raspbian

  20. 20

    Algorithm Negotiation failed when trying to connect to server

  21. 21

    android signalR hubconnection application negotiation failed with server

  22. 22

    Channel attributes to provide barriers in MQ

  23. 23

    Apache connection time out or rejected

  24. 24

    WAS MQ put by JmsConnectionFactory host unreachable

  25. 25

    WAS MQ put by JmsConnectionFactory host unreachable

  26. 26

    "Channel shutdown: connection error"

  27. 27

    Blackscreen - failed to idle channel

  28. 28

    MQ right way to close connection

  29. 29

    WebSphere MQ connection pooling with Tomcat

HotTag

Archive