Exceptions in IBM MQ classes for JMS

An IBM® MQ classes for JMS application must handle exceptions that are thrown by JMS API calls or that are delivered to an exception handler.

IBM MQ classes for JMS reports runtime problems by throwing exceptions. The type of exceptions that are thrown, and the way that these exceptions must be handled, depends on the version of the JMS specification that is used by your application:
  • Methods on the interfaces that are defined in JMS 1.1 and earlier throw checked exceptions. The base class of these exceptions is JMSException. For more information about how to handle checked exceptions, see Handling checked exceptions.
  • Methods on the interfaces added in JMS 2.0 throw unchecked exceptions. The base class for these exceptions is JMSRuntimeException. For more information on how to handle unchecked exceptions, see Handling unchecked exceptions.
You can also register an ExceptionListener with a JMS Connection or a JMSContext. The MQ classes for JMS then notify the ExceptionListener if either an issue is detected with a connection to the queue manager, or if an issue occurs while trying to deliver a message asynchronously. For more information, see ExceptionListeners.