javax.net.ssl.SSLHandshakeException: Received fatal alert: handshake_failure 解决方案

黎东
L、先森
2018-03-07 0 2980

在java程序中发送邮件会出现一个异常:

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

如果你的配置没有问题但是出现了这个问题,需要去oracle官网下载对应的jce包替换jdk中的jce包

jdk下载页:

JDK7 http://www.oracle.com/technetwork/java/javase/downloads/jce-7-download-432124.html

JDK8 http://www.oracle.com/technetwork/java/javase/downloads/jce8-download-2133166.html

下载之后解压,进入目录:

%JAVA_HOME%\jre\lib\security

替换 local_policy.jar,US_export_policy.jar,即可

java