Debugging MQ issues in Java code

1 1 1 1 1 1 1 1 1 1 Rating 0.00 (0 Votes)

While connecting to MQ using Java for pushing or getting data, we can experience issues. Generally, it is nice to understand the exact reason for exception. The exception may be during connecting to MQ queue manager or while sending / receiving error. The MQException class provides two variables which will help to zero down on the error. The two parameters are completionCode and reasonCode. The below snippet shows how the catch block is written to get the completionCode and reasonCode. It is assumed that the try block contains the MQ connectivity code.

 

try {
   //Some MQ connection code here
}  catch(MQException mqe) {
   System.err.println("MQ error occurred --> Completion code is " +
   mqe.completionCode + " and Reason code is " + mqe.reasonCode);
}



The below block shows an excerpt of the error log.


..
..
MQ error occurred --> Completion code is 2 Reason code is 2025


Once you have the error logs, you can look up the reason code and completion code in the IBM MQ help. The link is provided below:

http://publib.boulder.ibm.com/infocenter/wmqv7/v7r0m0/topic/com.ibm.mq.java.doc/constant-values.html#com.ibm.mq.MQException.MQCC_FAILED

For the above example:

The completion code 2 is MQCC_FAILED, which obviously means that something went wrong.

The reason code 2025 stands for MQRC_MAX_CONNS_LIMIT_REACHED, which means that maximum number of connections reached. A possible reason code which is hit when all the allocated MQ Queue manager connection is exhausted. A time to work with the MQ Admins guys!

 


Joomla SEO by MijoSEF