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.<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的,经过实践,修改如下:

[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,记录下该问题

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 打赏
    打赏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

不积跬步无以至千里-陕西西安

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值