Date Created: Tue 08-Mar-2011

Related Document Categories:


    com.ibm.mq.MQException: MQJE001: Completion Code '2', Reason '2059'.

    Problem (Solution is below)

    When using the WebSphere MQ resource adapter, most errors cause exceptions to be thrown, and these exceptions are reported to the user in a manner that depends on the application server. The resource adapter makes extensive use of linked exceptions to report problems. Typically, the first exception in a chain is a high level description of the error, and subsequent exceptions in the chain provide the more detailed information that is required to diagnose the problem.
    For example, if the IVT program fails to obtain a connection to a WebSphere MQ queue manager, the following exception might be thrown:

    javax.jms.JMSException: MQJCA0001: An exception occurred in the JMS layer.
    See the linked exception for details.

    Linked to this exception is a second exception:

    javax.jms.JMSException: MQJMS2005: failed to create an MQQueueManager for
    'localhost:ExampleQM'

    This exception is thrown by WebSphere MQ JMS and has a further linked exception:

    com.ibm.mq.MQException: MQJE001: An MQException occurred: Completion Code 2,
    Reason 2059

    This final exception indicates the source of the problem. Reason code 2059 is MQRC_Q_MGR_NOT_AVAILABLE, which indicates that the queue manager specified in the definition of the ConnectionFactory object might not have been started.



    DEBUG [main] (MQProcessor.java:185) - In mainProcessor()
    DEBUG [main] (MQProcessor.java:396) - P_QUEUEMANAGER[=QM_TEST]
    DEBUG [main] (PingQueueManager.java:21) - PingStatus...
    DEBUG [main] (PingQueueManager.java:23) - queueManagerName=[QM_TEST]
    MQJE001: Completion Code '2', Reason '2059'.
    com.ibm.mq.MQException: MQJE001: Completion Code '2', Reason '2059'.
    at com.ibm.mq.MQManagedConnectionJ11.<init>(MQManagedConnectionJ11.java:238)
    at com.ibm.mq.MQBindingsManagedConnectionFactoryJ11._createManagedConnection(MQBindingsManagedConnectionFactoryJ11.java:248)
    at com.ibm.mq.MQBindingsManagedConnectionFactoryJ11.createManagedConnection(MQBindingsManagedConnectionFactoryJ11.java:302)
    at com.ibm.mq.StoredManagedConnection.<init>(StoredManagedConnection.java:95)
    at com.ibm.mq.MQSimpleConnectionManager.allocateConnection(MQSimpleConnectionManager.java:182)
    at com.ibm.mq.MQQueueManagerFactory.obtainBaseMQQueueManager(MQQueueManagerFactory.java:869)
    at com.ibm.mq.MQQueueManagerFactory.procure(MQQueueManagerFactory.java:761)
    at com.ibm.mq.MQQueueManagerFactory.constructQueueManager(MQQueueManagerFactory.java:712)
    at com.ibm.mq.MQQueueManagerFactory.createQueueManager(MQQueueManagerFactory.java:171)
    at com.ibm.mq.MQQueueManager.<init>(MQQueueManager.java:603)
    at com.fr.utils.PingQueueManager.PingStatus(PingQueueManager.java:27)
    at com.fr.MQProcessor.connectionValid(MQProcessor.java:397)
    at com.fr.MQProcessor.mainProcessor(MQProcessor.java:194)DEBUG [main] (PingQueueManager.java:21) - PingStatus...


    Solution

    By adding the appropriate MQEnvironment settings in green below, the MQQueueManager connection factory now works.

    // Set up MQ environment
    MQEnvironment.hostname = hostname;
    MQEnvironment.channel = channel;
    MQEnvironment.port = port;


    _queueManager = new MQQueueManager(_queueManagerName);

    if(_queueManager.isConnected())
    {
    _queueManager.disconnect();
    _status = true;
    }else
    {
    _status = true;
    }

Middleware Mentor - Steven Charles Robinson

About Me

Steve Robinson has been working in IT for over 15 years and has provided solutions for many large-enterprise corporate companies across the world. Steve specialises in Java and Middleware consulting. Steve comes from both an administration and development background.

Before moving to JEE, Steve was an accomplished developer and consultant for both IBM Lotus Notes and Microsoft .NET Technologies.

Follow Steve as @stevencrobinson on twitter.

Read my books?

IBM WebSphere Application Server 8.0 Administration Guide

IBM WebSphere Application Server 8.0 Administration Guide

WebSphere Application Server 7.0 Administration Guide

WebSphere Application Server 7.0 Administration Guide

WebSphere Categories

Oracle WebLogic Categories

JBoss Categories

Other Categories