java.security.cet.CertPathValidatorException: Path does not chain with any of the trust anchors 解决办法

javax.net.ssl.SSLHandshakeException: java.security.cert.CertPathValidatorException 使用的是okhttp,https请求报异常: Caused by: javax.net.ssl.SSLHandshakeException: java.security.cert.CertPathValidatorException: Trust anchor for certification path not found. at org.conscrypt.ConscryptFileDescriptorSocket.startHandshake(ConscryptFileDescriptorS 阅读详情
AI摘要

本文介绍了在使用SpringBoot+Mybatis+MySQL开发过程中遇到的证书路径验证器异常问题及解决方法。通过关闭证书校验(设置useSSL=false),可以快速解决启动失败的问题。

问题简介:

项目使用的是 Spring Boot + Mybatis + MySQL 进行开发的,数据库访问使用 Spring Boot Data JPA ,主要用于简化 RDBMS 关系型数据库的访问与CRUD 操作。但是在启动项目时,启动失败,证书路径验证器异常 ,异常信息如下:

Caused by: javax.net.ssl.SSLHandshakeException: java.security.cert.CertificateException: java.security.cert.CertPathValidatorException: Path does not chain with any of the trust anchors
    at sun.security.ssl.Alerts.getSSLException(Alerts.java:192)
    at sun.security.ssl.SSLSocketImpl.fatal(SSLSocketImpl.java:1937)
    at sun.security.ssl.Handshaker.fatalSE(Handshaker.java:302)
    at sun.security.ssl.Handshaker.fatalSE(Handshaker.java:296)
    at sun.security.ssl.ClientHandshaker.serverCertificate(ClientHandshaker.java:1478)
    at sun.security.ssl.ClientHandshaker.processMessage(ClientHandshaker.java:212)
    at sun.security.ssl.Handshaker.processLoop(Handshaker.java:969)
    at sun.security.ssl.Handshaker.process_record(Handshaker.java:904)
    at sun.security.ssl.SSLSocketImpl.readRecord(SSLSocketImpl.java:1050)
    at sun.security.ssl.SSLSocketImpl.performInitialHandshake(SSLSocketImpl.java:1363)
    at sun.security.ssl.SSLSocketImpl.startHandshake(SSLSocketImpl.java:1391)
    at sun.security.ssl.SSLSocketImpl.startHandshake(SSLSocketImpl.java:1375)
    at com.mysql.jdbc.ExportControlled.transformSocketToSSLSocket(ExportControlled.java:186)
    ... 153 common frames omitted
Caused by: java.security.cert.CertificateException: java.security.cert.CertPathValidatorException: Path does not chain with any of the trust anchors
    at com.mysql.jdbc.ExportControlled$X509TrustManagerWrapper.checkServerTrusted(ExportControlled.java:302)
    at sun.security.ssl.AbstractTrustManagerWrapper.checkServerTrusted(SSLContextImpl.java:922)
    at sun.security.ssl.ClientHandshaker.serverCertificate(ClientHandshaker.java:1460)
    ... 161 common frames omitted
Caused by: java.security.cert.CertPathValidatorException: Path does not chain with any of the trust anchors
    at sun.security.provider.certpath.PKIXCertPathValidator.validate(PKIXCertPathValidator.java:153)
    at sun.security.provider.certpath.PKIXCertPathValidator.engineValidate(PKIXCertPathValidator.java:79)
    at java.security.cert.CertPathValidator.validate(CertPathValidator.java:292)
    at com.mysql.jdbc.ExportControlled$X509TrustManagerWrapper.checkServerTrusted(ExportControlled.java:295)
    ... 163 common frames omitted
14:03:23.865 [restartedMain] ERROR c.a.d.p.DruidDataSource - [init,905] - {dataSource-1} init error
com.mysql.jdbc.exceptions.jdbc4.CommunicationsException: Communications link failure

部分截图如下:
这里写图片描述

解决办法:

通常,我们连接数据库时,为了数据传输的安全性,都开启了证书的校验,如下图:
这里写图片描述

这儿只需要将证书的校验关闭即可,修改 useSSL=false
关于这个解决办法,只是解决了燃眉之急,让项目跑起来,具体的问题还在深入的探索中,如果那位仁兄有更好的问题探究和深入的解决方案,欢迎留言,在此万分感激!!!


好了,关于 java.security.cet.CertPathValidatorException: Path does not chain with any of the trust anchors 解决办法 就写到这儿了,如果还有什么疑问或遇到什么问题欢迎扫码提问,也可以给我留言哦,我会一一详细的解答的。
歇后语:“ 共同学习,共同进步 ”,也希望大家多多关注CSND的IT社区。

java.security.cert.CertPathValidatorException: Trust anchor for certification path not found. 首先,这个问题虽然暂时解决了,但是还没有完全解决不知道是怎么回事。 问题 在请求网络接口的时候,出现的异常: java.security.cert.CertPathValidatorException: Trust anchor for certification path not found. 描述一下问题: 使用的是HTTPS 第一次安装并且没有退出过应用,才会出现,其余100个接口没有问题,只有一个接口出现。重启应用后,再调用就不会再产生。 解决: 出现这个问题,与证书有关 检查一下证书认证的代码 阅读详情

相关推荐

java.security.cert.CertificateException: 证书异常的正确解决办法

java.security.cert.CertificateException: 证书异常的正确解决办法

wbajsjhhhhh的博客 3664

解决Path does not chain with any of the trust anchors问题

问题如下: 错误信息:java.security.cert.CertPathValidatorException: Path does not chain with any of the trust anchors 看到错误信息我百度翻译了一下说什么连接有问题,我就明白了估计是数据库连接路径有问题了,因为只有数据库加了路径连接 解决方法: 将useSSL=true改成useSSL=false即可 ...

li22356的博客 1万+

NVMe与PCIe的完美结合:高速存储背后的技术解析

本文深入解析了NVMe与PCIe技术如何完美结合,实现高速存储性能的飞跃。从机械硬盘到NVMe SSD的进化历程出发,详细介绍了PCIe总线的高带宽优势与NVMe协议的低延迟设计,以及两者协同工作带来的显著性能提升。通过实测数据对比,展示了NVMe SSD在消费级和企业级应用中的卓越表现,并提供了选购与优化建议。

weixin_29216353的博客 376

Caused by: java.security.cert.CertPathValidatorException: Path does not chain with any of the trust

最底部错误:Caused by: java.security.cert.CertPathValidatorException: Path does not chain with any of the trust anchors 错误原因:是因为开启了安全验证---------将安全验证改为false(useSSL=false) jdbc.driver=com.mysql.jdbc.Driver jdbc.url=jdbc:mysql://localhost:3306/ssmbuild?useSSL=fals

m0_50574545的博客 2141

深入分析大众点评 Ajax 接口:直接请求 JSON 数据高效获取评论

大众点评网站采用前后端分离架构,通过Ajax接口动态加载数据。按F12打开开发者工具,切换到Network(网络)面板。实际环境中,我们需要使用Python重现这一加密逻辑。查看请求响应,寻找包含评论数据的JSON接口。参数是大众点评的反爬机制核心,需要特别处理。:尊重网站的robots.txt文件规定。:仅将数据用于合法合规的研究和分析目的。:不侵犯大众点评的商业秘密和知识产权。打开大众点评网站,进入任意商户页面。:对采集到的用户信息进行脱敏处理。:避免对目标网站造成过大负担。

Z_suger7的博客 1579

从零到一:KUKA机械臂与ROS的工业级通讯协议深度解析

本文深度解析KUKA机械臂与ROS的工业级通讯协议,重点对比EKI与RSI两种核心接口的技术特点与应用场景。详细介绍了网络架构设计、数据包解析机制及ROS-I集成方法,并提供实时性能优化与故障排除策略,为工程师实现高可靠性工业自动化集成提供完整解决方案。

2a4s6d8f0g的博客 296

Path does not chain with any of the trust anchors异常解决

Path does not chain with any of the trust anchors异常解决 问题语句:jdbc.url=jdbc:mysql://192.168.23.129:3306/ssmbuild?useSSL=true&useUnicode=true&characterEncoding=utf8 解决方式:将useSSL=true改成useSSL=false 原因:根据MySQL 5.5.45+、5.6.26+和5.7.6+的要求,为了数据的安全及维护,如果不设置显式

m0_56356993的博客 3232

计算机视觉——多视图几何

多视图几何1.前言1.1 多视图几何概念2. 基本原理2.1 对极几何2.2 基础矩阵2.2.1 基础矩阵推导2.2.2 求解基础矩阵3. 实验过程3.1 实验数据准备3.2 实验代码3.3 实验结果及分析4. 实验中遇到的问题 1.前言 1.1 多视图几何概念 多视图几何是利用在不同视点所拍摄图像间的关系,来研究照相机之间或者特征之间关系的一门科学。 多视图几何(Multiple View ...

RuiMa的博客 7715

使用优快云-markdown编辑器入门

这里写自定义目录标题欢迎使用Markdown编辑器新的改变功能快捷键合理的创建标题,有助于目录的生成如何改变文本的样式插入链接与图片如何插入一段漂亮的代码片生成一个适合你的列表创建一个表格设定内容居中、居左、居右SmartyPants创建一个自定义列表如何创建一个注脚注释也是必不可少的KaTeX数学公式新的甘特图功能,丰富你的文章UML 图表FLowchart流程图导出与导入导出导入 欢迎使用Ma...

大米饭 3445

足球赛事数据API:开发者生存指南(附真实踩坑记录)

作为一个既爱看球又爱写代码的老宅男,我这些年用过的足球API比看过的比赛还多。从最初被各种API文档折磨到怀疑人生,到现在能闭着眼睛调接口,中间的血泪史够写本书了。今天就把这些经验(和教训)分享给各位同好,特别是那些正在为"老板要做个足球App"而秃头的同行们。文档清晰免费层可用响应格式规范API-Sports免费额度大方支持GraphQL有中文文档(难得!Sportmonks数据全面有Webhook支持按需付费。

Happy0970的博客 2189

linux cma alloc fail 问题分析

摘要:日志显示CMA连续内存分配失败(错误码-ENOMEM),请求128页(512KB)内存时因CMA区域不足或内存碎片导致失败。分析发现系统CMA总内存131072KB,空闲65536KB。解决方案包括:1)手动触发内存碎片整理;2)修改设备树或内核配置增大CMA区域(如从16MB增至20MB)。通过调整CONFIG_CMA_SIZE_MBYTES或设备树中的size参数可解决该问题。

陌上花开缓缓归以的博客 796

java.security.cert.CertPathValidatorException: Path does not chain with any of the trust anchors

java.security.cert.CertPathValidatorException: Path does not chain with any of the trust anchors 出现这个错误是因为URL中出现了useSSL=true,只需要改成false即可。 jdbc:mysql://localhost:3306/demo?useUnicode=true&characterEncoding=utf-8&serverTimezone=UTC&useSSL=true

qq_44014971的博客 1591

YOLO11实战优化:长尾分布解决 | 引入Seesaw Loss配合YOLO11分类头,完美应对类别极其不平衡的现实业务场景

摘要: YOLO11在工业缺陷检测等长尾分布场景中面临尾部类别检测失效的问题,根源在于头部类别样本的负样本梯度压制了尾部类别的学习。传统方法如重采样、Focal Loss等效果有限。Seesaw Loss通过动态调整缓解因子和补偿因子,平衡类别间的梯度分布,结合YOLO11的解耦分类头、Anchor-Free设计和C2PSA/C3K2模块,显著提升尾部类别识别能力。文章详细解析了Seesaw Loss的数学原理,并提供了可直接集成到YOLO11的PyTorch实现代码,为长尾分布下的目标检测提供了实用解决方

2601_95807009的博客 251

Path does not chain with any of the trust anchors

SpringBoot项目启动报错,报错原因: Path does not chain with any of the trust anchors 原因就是连接Mysql的URL中的useSSL设置为true,设置为false,项目重新启动成功

GreatOneDay的博客 1679

静态时序分析—伪路径(set_false_path)

set_false_path应用场景

m0_61544122的博客 2万+

霍尼韦尔SoftMaster使用说明

霍尼韦尔SoftMaster使用说明

已解决java.security.cert.CertificateException: 证书异常的正确解决方法,亲测有效!!!

已解决java.security.cert.CertificateException: 证书异常的正确解决方法,亲测有效!!!

小明的Java问道之路 8470

精雕软件(JDpaint) 5.5 绿色版

精雕软件(JDpaint) 5.5 绿色版精雕软件(JDpaint) 5.5 绿色版精雕软件(JDpaint) 5.5 绿色版

Path does not chain with any of the trust anchors问题的解决方法

项目启动连接mysql数据库时报了如下错误 Caused by: java.security.cert.CertPathValidatorException: Path does not chain with any of the trust anchors at sun.security.provider.certpath.PKIXCertPathValidator.validate(Unkn...

huangbaokang的博客 2492

廖雪峰Python教程[完整版]

廖雪峰的python教程整理的,已经排好版了,而且还是完整的,适合小白

复分析 阿尔福斯(Ahlfors) 第三版答案 英文

答案分为十章,有部分习题没有答案,全英文复分析阿尔福斯(Ahlfors) 第三版答案

解决 java.security.cert.CertPathValidatorException: Trust anchor for certification path not found

方案1 try { CertificateFactory cf = CertificateFactory.getInstance("X.509"); // uwca.crt 打包在 asset 中,该证书可以从https://itconnect.uw.edu/security/securing-computer/install/safari-os-x/下载 Inp...

qq_36755922的博客 2万+

Caused by: java.security.cert.CertificateException: java.security.cert.CertPathValidatorException

把源文件配置,此处代码:useSSL=true 改成useSSL=false即可

SwaeLeeUknow的博客 1777

java.security path_我是如何解决java.security.cert.CertPathValidatorException异常的

问题来了昨天,我还在我的工位上愉快的敲的代码,有位开发组的同事Z给我发消息。开发组同事Z:大哥,这个PKI的登录功能是你做的吗?我:是呀!N年前的事了。。。开发组同事Z:PKI登录功能出问题了!有位客户使用他的PKI登录我们做的系统,登录时报错,换了几台电脑也不行。但是他使用他的PKI能登录其他的系统。能帮忙看一下吗,我找过好多同事看过了,他们看了下,都不知道如何入手我:报错是报什么错?能具体的描...

weixin_42356340的博客 3022

java.security.cert.CertPathValidatorException: Path does not chain with any of the trust

java.security.cert.CertPathValidatorException: Path does not chain with any of the trust

keaidewozhenkeai的博客 1757
上一篇: Linux使用基本目录介绍
下一篇: Caused by: java.lang.ClassNotFoundException: org.apache.log4j.Priority 的解决办法
TechBro华仔
TechBro华仔 优质创作者: Java技术领域 优质创作者: Java技术领域 领域专家: 后端开发技术领域 领域专家: 后端开发技术领域
博客等级 码龄11年 5万+粉丝 430原创
评论 9
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

个

红包个数最小为10个

元

红包金额最低5元

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

打赏作者

TechBro华仔

日拱一卒无有尽,功不唐捐终入海

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

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

打赏作者

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

抵扣说明:

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

余额充值