# Exceptions

The methods of Qpid JMS Client throw JMSExceptions in response to error conditions. Typically the exception's message (#getMessage()) summarises the error condition, with contextual information being provided by the messages of linked exception(s). To understand the problem, it is important to read the messages associated with all the linked exceptions.

The following table describes some of the more common exceptions linked to JMSException thrown by JMS methods whilst using the client:

Exceptions linked to JMSExceptions thrown by JMS methods

Linked Exception | Message | Explanation/Common Causes
--- | --- | ---
AMQUnresolvedAddressException | message varies | Indicates that the hostname included in the Connection URL's brokerlist, could not be resolved, . This could mean that the hostname is mispelt, or there is name resolution problem.
AMQConnectionFailure | Connection refused | Indicates that the host included in the Connection URL's brokerlist, actively refused the connection. This could mean that the hostname and/or port number is incorrect, or the Broker may not be running.
AMQConnectionFailure | connect timed out | Indicates that the host included in the Connection URL's brokerlist, could not be contacted within the connecttimeout. This could mean that the host is shutdown, or a networking routing problem means the host is unreachable.
AMQConnectionFailure | General SSL Problem; PKIX path building failed; unable to find valid certification path to requested target | Indicates that the CA that signed the Broker's certificate is not trusted by the JVM of the client. If the Broker is using a private-CA (or a self signed certificate) check that the client has been properly configured with a truststore. See
AMQTimeoutException | Server did not respond in a timely fashion; Request Timeout | Indicates that the broker did not respond to a request sent by the client in a reasonable length of time. The timeout is governed by `qpid.sync_op_timeout`. This can be a symptom of a heavily loaded broker that cannot respond or the Broker may have failed in unexpected manner. Check the broker and the host on which it runs and performance of its storage.

The following table describes some of the more common exceptions linked to JMSException sent to ExceptionListener instances.

Exceptions linked to JMSExceptions received by ExceptionListeners

Linked Exception | Message | Explanation/Common Causes
--- | --- | ---
AMQNoRouteException | No Route for message [Exchange: exchange name, Routing key: routing key] [error code 312: no route] | Indicate that the named exchange is unable to route a message to at least one queue. This will occur if a queue has been improperly bound to an exchange. Use the Broker's management interface to check the bindings. See
AMQNoConsumersException | Immediate delivery is not possible. [error code 313: no consumers] | Immediate delivery was requested by the MessageProducer, but as there are no consumers on any target queue, the message has been returned to the publisher. See
AMQDisconnectedException | Server closed connection and reconnection not permitted | Indicates that the connection was closed by the Broker, and as failover options are not included in the Connection URL, the client has been unable to reestablish connection. The Connection is now closed and any attempt to use either Connection object, or any objects created from the Connection will receive an IllegalStateException.
AMQDisconnectedException | Server closed connection and no failover was successful | Indicates that the connection was closed by the Broker. The client has tried failover according to the rules of the failover optionswithin the Connection URL, but these attempts were all unsuccessful. The Connection is now closed and any attempt to use either Connection object, or any objects created from the Connection will receive an IllegalStateException.