栏目分类:
子分类:
返回
名师互学网用户登录
快速导航关闭
当前搜索
当前分类
子分类
实用工具
热门搜索
名师互学网 > IT > 软件开发 > 后端开发 > Java

javax.net.ssl.SSLHandshakeException: No appropriate protocol (protocol is disabled or cipher suites

Java 更新时间: 发布时间: IT归档 最新发布 模块sitemap 名妆网 法律咨询 聚返吧 英语巴士网 伯小乐 网商动力

javax.net.ssl.SSLHandshakeException: No appropriate protocol (protocol is disabled or cipher suites

本地服务运行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.(HandshakeContext.java:171) ~[na:1.8.0_301]
	at sun.security.ssl.ClientHandshakeContext.(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的,经过实践,修改如下:

[root@iZ2ze9na41n2px47aknoqwZ security]# cd /usr/local/java/jdk1.8.0_301/jre/lib/security/
[root@iZ2ze9na41n2px47aknoqwZ security]# ls
blacklist  blacklisted.certs  cacerts  java.policy  java.security  javaws.policy  policy  public_suffix_list.dat  trusted.libraries
[root@iZ2ze9na41n2px47aknoqwZ 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,记录下该问题

转载请注明:文章转载自 www.mshxw.com
本文地址:https://www.mshxw.com/it/271816.html
我们一直用心在做
关于我们 文章归档 网站地图 联系我们

版权所有 (c)2021-2022 MSHXW.COM

ICP备案号:晋ICP备2021003244-6号