Hands-on AWS knowledge base for developers Managed Ops
Talk to Us

Java: SSLHandshakeException Received fatal alert: handshake_failure

Export PDF Print-friendly layout with a copyright watermark; choose Save as PDF in the print dialog
Java: SSLHandshakeException Received fatal alert: handshake_failure — Java: SSLHandshakeException Received fatal alert: handshake_failure

原因

TLS 握手协商失败:JDK 版本过老不支持服务端要求的 TLS 1.3,或双方没有共同加密套件,也可能是服务端禁用了客户端提供的所有协议。

解决

  1. 确认 JDK 版本:JDK 8u261+/11.0.7+ 才完整支持 TLS 1.3;
  2. 用 -Djavax.net.debug=ssl:handshake 打印握手过程定位卡在哪一步;
  3. 服务端配置兼容:ssl_protocols TLSv1.2 TLSv1.3;;
  4. 客户端限制协议时可显式:System.setProperty("https.protocols", "TLSv1.2,TLSv1.3")。