javax.net.ssl.SSLHandshakeException: No appropriate protocol (protocol is disabled or cipher suites are inappropriate)
Java has no TLS version it may use with this server
Seen in Java 8u291+ and 11+, JDBC drivers (MySQL, SQL Server), JavaMail, Spring
The Java client was left with no enabled TLS version or cipher suite to offer, usually because the only ones allowed are disabled in the JDK.
Common causes
- The server or driver only supports TLS 1.0 or 1.1, which recent JDKs disable in jdk.tls.disabledAlgorithms.
- An old JDBC driver or library that hard-codes TLSv1 or TLSv1.1.
- Code that forces a single protocol the JDK does not allow.
How to fix it
- Upgrade the server to support TLS 1.2 or 1.3; this is the real fix.
- Update the JDBC driver or library, and set its TLS version option to TLSv1.2 or higher.
- Run with -Djavax.net.debug=ssl:handshake to see which protocols were disabled.
- Re-enabling TLS 1.0/1.1 in java.security weakens security; use it only briefly for a legacy server.
Got a different message? Paste it into the error explainer.
Related errors
- Max retries exceeded with url · requests gave up connecting to the URL
- http.client.RemoteDisconnected: Remote end closed connection without response · The server closed the connection without replying
- [SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed · Python couldn't verify the server's certificate
- certificate verify failed: Hostname mismatch, certificate is not valid for · The certificate doesn't cover this hostname
- socket.gaierror: [Errno -2] Name or service not known · Python couldn't resolve the hostname
- socket.gaierror: [Errno -3] Temporary failure in name resolution · Python couldn't reach a DNS resolver
- requests.exceptions.ConnectTimeout · Python couldn't open the connection in time
- requests.exceptions.ReadTimeout · The server took too long to respond
- ConnectionRefusedError: [Errno 111] Connection refused · Nothing is listening on that port
- PKIX path building failed · Java can't build a trusted certificate chain
- javax.net.ssl.SSLHandshakeException: Received fatal alert: handshake_failure · The server rejected the TLS handshake
- java.net.UnknownHostException · Java couldn't resolve the hostname