javax.net.ssl.SSLHandshakeException: No appropriate protocol (protocol is disabled or cipher suites
程序员文章站
2022-03-04 13:08:39
...
本地服务运行ok,将本地代码打jar包放置linux上运行时,查询数据库报错如下,
The last packet sent successfully to the server was 0 milliseconds ago. The driver has not received any packets from the server.
### The error may exist in URL [jar:file:/mydata/nginx/html/gulimall-file-0.0.1-SNAPSHOT.jar!/BOOT-INF/classes!/mapper/UploadDao.xml]
### The error may involve com.dk.gulimall.file.dao.UploadDao.getRecords
### The error occurred while executing a query
### Cause: org.springframework.jdbc.CannotGetJdbcConnectionException: Failed to obtain JDBC Connection; nested exception is com.mysql.cj.jdbc.exceptions.CommunicationsException: Communications link failure
The last packet sent successfully to the server was 0 milliseconds ago. The driver has not received any packets from the server.] with root cause
javax.net.ssl.SSLHandshakeException: No appropriate protocol (protocol is disabled or cipher suites are inappropriate)
at sun.security.ssl.HandshakeContext.<init>(HandshakeContext.java:171) ~[na:1.8.0_301]
at sun.security.ssl.ClientHandshakeContext.<init>(ClientHandshakeContext.java:101) ~[na:1.8.0_301]
at sun.security.ssl.TransportContext.kickstart(TransportContext.java:238) ~[na:1.8.0_301]
at sun.security.ssl.SSLSocketImpl.startHandshake(SSLSocketImpl.java:394) ~[na:1.8.0_301]
at sun.security.ssl.SSLSocketImpl.startHandshake(SSLSocketImpl.java:373) ~[na:1.8.0_301]
at com.mysql.cj.protocol.ExportControlled.performTlsHandshake(ExportControlled.java:316) ~[mysql-connector-java-8.0.17.jar!/:8.0.17]
at com.mysql.cj.protocol.StandardSocketFactory.performTlsHandshake(StandardSocketFactory.java:188) ~[mysql-connector-java-8.0.17.jar!/:8.0.17]
at com.mysql.cj.protocol.a.NativeSocketConnection.performTlsHandshake(NativeSocketConnection.java:99) ~[mysql-connector-java-8.0.17.jar!/:8.0.17]
at com.mysql.cj.protocol.a.NativeProtocol.negotiateSSLConnection(NativeProtocol.java:331) ~[mysql-connector-java-8.0.17.jar!/:8.0.17]
at com.mysql.cj.protocol.a.NativeAuthenticationProvider.negotiateSSLConnection(NativeAuthenticationProvider.java:777) ~[mysql-connector-java-8.0.17.jar!/:8.0.17]
网上有说改本地打包环境的,也有说改linux的,经过实践,修改如下:
[[email protected] security]# cd /usr/local/java/jdk1.8.0_301/jre/lib/security/
[[email protected] security]# ls
blacklist blacklisted.certs cacerts java.policy java.security javaws.policy policy public_suffix_list.dat trusted.libraries
[[email protected] security]# vim java.security
查找需要修改的地方,/jdk.tls.disabledAlgorithms=
yy p
把原始配置注释掉,删掉了SSLv3, TLSv1, TLSv1.1,
#jdk.tls.disabledAlgorithms=SSLv3, TLSv1, TLSv1.1, RC4, DES, MD5withRSA, \
jdk.tls.disabledAlgorithms=RC4, DES, MD5withRSA, \
DH keySize < 1024, EC keySize < 224, 3DES_EDE_CBC, anon, NULL, \
include jdk.disabled.namedCurves
reboot重启下,或许不重启是可以的,我是重启的
请求ok,记录下该问题
上一篇: 知识图谱实例简介
推荐阅读
-
阿里数据库连接池Druid 连接MySQL失败:javax.net.ssl.SSLHandshakeException: No appropriate protocol
-
连接数据库报错:Caused by: javax.net.ssl.SSLHandshakeException: No appropriate protocol的一个解决方法
-
springboot+mysql+ SSLHandshakeException: No appropriate protocol is disabled cipher+state 08S01
-
HikariCP数据库连接池连接MySQL失败:javax.net.ssl.SSLHandshakeException: No appropriate protocol
-
Java调用ssl异常,javax.net.ssl.SSLHandshakeException: No appropriate protocol
-
mail No appropriate protocol (protocol is disabled or cipher suites are inappropriate)
-
Java调用ssl异常(javax.net.ssl.SSLHandshakeException: No appropriate protocol (protocol is disabled or ci
-
Java调用ssl出现异常:javax.net.ssl.SSLHandshakeException: No appropriate protocol
-
javax.net.ssl.SSLHandshakeException: No appropriate protocol (protocol is disabled or cipher suites
-
已解决:javax.net.ssl.SSLHandshakeException: No appropriate protocol 问题