如题,jdk8启动项目时报SSL异常。
Caused by: javax.net.ssl.SSLHandshakeException: No appropriate protocol (protocol is disabled or cipher suites are inappropriate)
at sun.security.ssl.HandshakeContext.<init>(HandshakeContext.java:171)
at sun.security.ssl.ClientHandshakeContext.<init>(ClientHandshakeContext.java:101
这是由于JDK8禁用了SSL连接,我们可以开启连接,只需要改一下java.security文件的一些配置即可。
路径:
// mac
/Library/Java/JavaVirtualMachines/jdk1.8.0_311.jdk/Contents/Home/jre/lib/security/java.security
// windows
\jdk1.8.0_311\jre\lib\security\java.security
找到该内容(jdk.tls.disabledAlgorithms):
jdk.tls.disabledAlgorithms=SSLv3, TLSv1, TLSv1.1, RC4, DES, MD5withRSA, \
DH keySize < 1024, EC keySize < 224, 3DES_EDE_CBC, anon, NULL, \
include jdk.disabled.namedCurves
将SSLv3去掉即可,如果需要的话,也可以把TLSv1, TLSv1.1去掉:
jdk.tls.disabledAlgorithms=RC4, DES, MD5withRSA, \
DH keySize < 1024, EC keySize < 224, 3DES_EDE_CBC, anon, NULL, \
include jdk.disabled.namedCurves
然后再启动项目,成功!