Menu Search

Appendix A. Exceptions

The methods of the 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:

Table A.1. Exceptions linked to JMSExceptions thrown by JMS methods

Linked ExceptionMessageExplanation/Common Causes
AMQUnresolvedAddressExceptionmessage 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.

AMQConnectionFailureConnection 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.

AMQConnectionFailureconnect 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.

AMQConnectionFailureGeneral 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 Section 5.3.3, “SSL”

AMQConnectionFailure / AMQAuthenticationExceptionnot allowed

Indicates that the user cannot be authenticated by the Broker. Check the username and/or password elements within the Connection URL.

AMQConnectionFailure / AMQSecurityExceptionPermission denied: virtualhost name; access refused

Indicates that the user is not authorised to connect to the given virtualhost. The user is recognised by the Broker and is using the correct password but does not have permission. This exception normally indicates that the user (or group) has not been permissioned within the Broker's Access Control List (ACL).

AMQTimeoutExceptionThe server's response was not received within the time-out period of %d ms.

Indicates that the Broker's response to the request sent by the client was not received within a timely fashion. The timeout is governed by qpid.sync_op_timeout .

This can be a symptom of a heavily loaded Broker, an overloaded network or a client JVM itself which is too overloaded to process incoming responses. Check for unreasonably long garbage collection pauses.

AMQSecurityExceptionPermission denied: message varies

Indicates that the user is not authorised to use the given resource or perform the given operation. This exception normally indicates that the user (or group) has not been permissioned within the Broker's Access Control List (ACL).

CertificateExceptionUnable to find certificate for recipient '<recipient>'

When using end to end message encryption, this exception indicates the the message recipent's principal cannot be found in the truststore. See Chapter 9, Message Encryption


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

Table A.2. Exceptions linked to JMSExceptions received by ExceptionListeners

Linked ExceptionMessageExplanation/Common Causes
AMQNoRouteExceptionNo 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 Section 5.5.1, “Mandatory Messages”

AMQNoConsumersExceptionImmediate 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 Section 5.5.3, “Immediate Messages”

AMQDisconnectedExceptionServer 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.

AMQDisconnectedExceptionServer 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.