新项目报:Caused by: javax.net.ssl.SSLHandshakeException:

新项目启动时遇到Caused by: javax.net.ssl.SSLHandshakeException错误。解决方法是在SpringBoot项目的配置文件中,针对MySQL的URL添加&useSSL=false参数。这能避免由于 JDK 版本(此处为1.8.0_301)导致的安全验证问题,允许通过账号密码而非SSL进行连接。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

新项目启动,报错,错误见下面三个图片
在这里插入图片描述

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.

在这里插入图片描述

Caused by: com.mysql.cj.exceptions.CJCommunicationsException: 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.

在这里插入图片描述

Caused by: javax.net.ssl.SSLHandshakeException: No appropriate protocol (protocol is disabled or cipher suites are inappropriate)

解决办法

在项目配置文件yml的mysql的url 最后添加 &useSSL=false

jdbc:mysql://192.168.1.101:3306/xxx_admin?useUnicode=true&characterEncoding=UTF-8&serverTimezone=Asia/Shanghai&useSSL=false

在这里插入图片描述
添加后就不再报错。

原因:当前jdk版本 jdk1.8.0_301
:“useSSL=true 是进行安全验证,一般通过证书或者令牌,useSSL=false就是通过账号密码进行连接,通常使用useSSL=false。

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

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

余额充值