Skip to content
MtrXTools

javax.net.ssl.SSLHandshakeException: Received fatal alert: handshake_failure

The server rejected the TLS handshake

Seen in Java, Spring, Android, Kotlin, Scala

The server sent a handshake_failure alert because it could not agree on TLS settings with the Java client.

Common causes

  • No cipher suite or TLS version in common, often an old JDK or a cipher disabled in java.security.
  • SNI not sent, for example when connecting by IP, so the server has nothing to offer.
  • The server requires a client certificate and none was presented.

How to fix it

  1. Run with -Djavax.net.debug=ssl:handshake to see what each side offered.
  2. Update the JDK so it supports TLS 1.2 and 1.3 with modern ciphers.
  3. For mutual TLS, configure a keystore with the client certificate (javax.net.ssl.keyStore).
  4. Check which TLS versions the server accepts.
Check the TLS versions the server accepts

Got a different message? Paste it into the error explainer.

Related errors

All 32 Languages & runtimes errors