RabbitMQ client SSL handshake issue on JDK 11
System Design practice on Codemia
Work through 120+ system design problems with detailed solutions, from rate limiters to multi-region storage.
Introduction
Secure communication between clients and servers is a critical aspect of modern software systems. RabbitMQ, a popular open-source message broker, supports SSL/TLS for encrypting data in transit. When using RabbitMQ with Java clients, especially with JDK 11, users may encounter issues during the SSL handshake process. This article explores common SSL handshake issues with RabbitMQ clients on JDK 11, providing technical explanations and examples to guide users through troubleshooting and resolution.
Understanding SSL/TLS in RabbitMQ with JDK 11
Secure Sockets Layer (SSL) and its successor, Transport Layer Security (TLS), are protocols for encrypting information over the internet. RabbitMQ utilizes these protocols to secure the data being transmitted between the server and clients. JDK 11, which made significant changes to the way SSL/TLS is handled compared to previous versions, often leads to complications, especially regarding protocol versions and cipher suites.
Key Changes in JDK 11:
- Removal of TLS 1.0 and 1.1 from default-enabled protocols
- Introduction of more stringent checks and requirements for certificates
- Enhanced support for TLS 1.3
Common SSL Handshake Issues
SSL handshake issues generally occur when the client and server fail to agree on the protocol version or cipher suites. These issues may manifest as exceptions in the Java client, such as SSLHandshakeException.
Examples of Exceptions:
javax.net.ssl.SSLHandshakeException: Received fatal alert: handshake_failurejavax.net.ssl.SSLProtocolException: Protocol version or cipher suite mismatch
Causes and Troubleshooting
The following table summarizes common causes of SSL handshake issues and troubleshooting tips:
| Issue Cause | Description | Troubleshooting Tips |
| Unsupported SSL/TLS version | The server or client is using a protocol version that is not supported by the other. | Ensure both server and client support the same versions. Update your client/server configuration if necessary. |
| Mismatched cipher suites | The client and server do not have any cipher suites in common. | Configure both client and server to use compatible cipher suites. |
| Invalid or untrusted certificates | The SSL certificate used is either self-signed, expired, or not trusted by the other party's trust store. | Update the certificate, or update the trust store settings appropriately. |
| Insufficient cryptographic strength | Some JDK versions limit the strength of cryptographic algorithms (e.g., key length restrictions). | Install the Java Cryptography Extension (JCE) Unlimited Strength Jurisdiction Policy Files if applicable. |
Detailed Troubleshooting Steps
- Check Protocol Versions: Verify that both the RabbitMQ server and the JDK 11 client are configured to use compatible SSL/TLS protocol versions. You can use the RabbitMQ configuration file to specify the versions:
- Verify Cipher Suites: Make sure that the cipher suites enabled in your RabbitMQ server configuration are also supported and enabled in JDK 11:
On the client-side in Java:
- Certificate Management: Ensure that all certificates in the chain are trusted by both the client and server. If using a self-signed certificate, import it into Java's trust store:
Conclusion
SSL/TLS issues in RabbitMQ client-server communication can arise due to various configurations and environmental factors. A systematic approach—starting from verifying protocol versions to managing certificates and cipher suites—can help in effectively resolving these issues. Continuous monitoring and updating of both RabbitMQ and JDK settings are key to maintaining secure and effective communication channels.
Related reading
- RabbitMQ closes connection when processing long running tasks and timeout settings produce errors
- RabbitMQ cluster is not reconnecting after network failure
- RabbitMQ clustering and mirror queues behavior behind the scenes
- RabbitMQ command doesn't exist?
- RabbitMQ handshake error when attempting to use SSL certificates
- RabbitMQ node authentification failed after changing cookie file
- RabbitMQ Java client - How to sensibly handle exceptions and shutdowns?
- RabbitMQ Java Client Using DefaultConsumer vs QueueingConsumer

System Design Fundamentals
Build a strong foundation in designing scalable, reliable distributed systems.
View the courseTrack what you have practised
A free account saves your progress, solutions and study plan across every problem on Codemia.
System Design practice on Codemia
Work through 120+ system design problems with detailed solutions, from rate limiters to multi-region storage.