happyNewLife
happyNewLife

Reputation: 87

Resolving MQRC 2195 errors in IBM MQ standalone application

SOLVED

I found the answer from IBM Technote IZ66146

Hope it helps others with same problem.


I wrote a simple method to a read messages from an MQ Queue.
In a loop, I try to read a message (with waitInterval). After reading a message successfully from the queue, a 2195 return code is returned. How can I resolve this?

Here is simplified version of my code without exception handling or any other thing.

   public static void main(String args[]) {
    MQException.logExclude(MQException.MQRC_NO_MSG_AVAILABLE);
    MQException.logExclude(MQException.MQRC_UNEXPECTED_ERROR);
    MQException.log = null;
            while (true) {
        incomeDeployMsg = readFromQueue(waitReadInterval);
                    System.out.println(dateFormater.format(new Date()) + " Income msg");
            }
   } 
    public String readFromQueue(int waitInterval) throws MQException{
    MQMessage message = new MQMessage();
    try {
        if (m_inQueue == null || !m_inQueue.isOpen())
            m_inQueue = m_mqQmgr.accessQueue(m_inQueueName, CMQC.MQOO_INQUIRE + CMQC.MQOO_FAIL_IF_QUIESCING + CMQC.MQOO_INPUT_SHARED);
        message.messageId = CMQC.MQMI_NONE;
        MQGetMessageOptions gmo = new MQGetMessageOptions();
        gmo.options = CMQC.MQGMO_WAIT;
        gmo.waitInterval = waitInterval;
        m_inQueue.get(message, gmo);
                    return message.readStringOfCharLength(message.getMessageLength());
    } catch (MQException mqe) {
        throw mqe;
    } finally {
        message.clearMessage();
    }
}

The first line in the result is not from my code!!! I think it is IBM's classes that print it out on standard output. How can I resolve the error?

Result:

MQJE001: Completion Code '2', Reason '2195'.
2013-05-15 11:44:27 Income msg

Upvotes: 1

Views: 4152

Answers (3)

Yee Yang
Yee Yang

Reputation: 1

I have face the problem, even I set

MQException.log = null;

It still printed out "MQJE001: Completion Code '2', Reason '2195'. "

End up i found out, the line is printed from MQDataException.

Added below line to solve the issue.

MQDataException.log = null;

Upvotes: 0

Roger
Roger

Reputation: 7476

Comment out the 2 lines with MQException.logExclude() and just use:

MQException.log = null;

Upvotes: 2

nitgeek
nitgeek

Reputation: 1258

If you don't want this, then in your catch block, check if the exception's reason code is 2195 and write the code accordingly.

Like:

catch (MQException mqe) {
     if(mqe.reasonCode==2195)
     {
/* DO NOTHING FOR THIS ERROR */

      }
     else
     {  
        throw mqe;
      }

}

Upvotes: 0

Related Questions