Java: javax.net.ssl.SSLHandshakeException: Received fatal alert: handshake_failure
The server rejected the Java client's TLS offer — no shared protocol/cipher, SNI issue or a required client certificate.
javax.net.ssl.SSLHandshakeException: Received fatal alert: handshake_failureReceived fatal alert: handshake_failureRemote host closed connection during handshakejavax.net.ssl.SSLException: Unsupported or unrecognized SSL messageReceived fatal alert: protocol_version Meaning
Run with -Djavax.net.debug=ssl:handshake to see the ClientHello and the alert. Old JDKs (Java 7 default TLS 1.0) can't talk to TLS 1.2-only servers; new JDKs disable weak algorithms (jdk.tls.disabledAlgorithms) that old servers still use. Upgrade or align both sides.
Common causes
- Old JDK without TLS 1.2 by default
- Server demands a client certificate
- Disabled algorithms (TLS 1.0/1.1, 3DES) in new JDK
- SNI not sent (rare)
- Weak DH key rejected
⚡ Quick fix
- Enable debug:
-Djavax.net.debug=ssl:handshake - Use a modern JDK and TLS 1.2+
- Provide the keystore for mTLS:
-Djavax.net.ssl.keyStore=...
Detailed fix by platform
Linux
java -Djavax.net.debug=ssl:handshake -jar app.jar 2>&1 | head -100
How to diagnose
- Debug — ClientHello vs server alert?
- JDK — Version?
- mTLS — Required?
🔧 Still not fixed?
Many errors look alike. If the steps above didn’t solve it, one of these is probably what you’re facing:
Similar errors
- EOF occurred in violation of protocol Python: ssl.SSLEOFError: EOF occurred in violation of protocol (_ssl.c:2396)
- gRPC: Ssl handshake failed / authentication handshake failed gRPC: rpc error: code = Unavailable desc = connection error: desc = "transport: authentication handshake failed: x509: certificate signed by unknown authority"
- Keystore was tampered with, or password was incorrect Java keytool: java.io.IOException: Keystore was tampered with, or password was incorrect
Most viewed in SSL / TLS
- NET::ERR_CERT_COMMON_NAME_INVALID NET::ERR_CERT_COMMON_NAME_INVALID: Your connection is not private (certificate is for a different domain)
- Challenge failed for domain Let’s Encrypt / Certbot: Challenge failed for domain example.com — Invalid response from http://example.com/.well-known/acme-challenge/x: 404
- no start line OpenSSL: unable to load certificate / PEM routines:get_name:no start line (key values mismatch)
Other ways to find it
Where this error sits
Origin: Network. Errors that are often confused with or caused by this one (click to open):
🧠 Still stuck? Analyze your error
Paste the full message, response headers or stack trace — we'll detect the platform and point to the most likely cause.
💬 What worked for others
No tips yet — did something else fix this for you?
Share what worked for you
Tips are checked by an editor before they appear. Links are removed.
Report a correction or suggest an improvement
Last updated 4 Nov 2026