当前位置:网站首页>Solve the problem of "suncertpathbuilderexception: unable to find valid certification path to requested target"
Solve the problem of "suncertpathbuilderexception: unable to find valid certification path to requested target"
2022-04-23 11:07:00 【Love blog uncle】
solve 『SunCertPathBuilderException:unable to find valid certification path to requested target』 problem
* problem
stay maven When compiling , A certificate verification error occurred , part log as follows :
javax.net.ssl.SSLHandshakeException: sun.security.validator.ValidatorException: PKIX path building failed: sun.security.provider.certpath.SunCertPathBuilderException: unable to find valid certification path to requested target
This problem is usually when accessing maven Web sites that depend on Libraries (https Of ) when , The certificate was replaced , And then it leads to .
Why are certificates replaced ? The possible reasons are , The proxy server acts as a middleman , stay https During transmission , Replace the server's certificate with , Then you can listen https The flow of . Usually , That's what the company does . Here, the proxy server takes advantage of https The key exchange process of the protocol , You can refer to this article : Eliminate illiteracy HTTPS and SSL/TLS agreement
Solve this problem , There are two ways .
* Method 1: by maven Add attribute maven.wagon.http.ssl.insecure=true
stay mvn Add... After the order -Dmaven.wagon.http.ssl.insecure=true
. This property is to let maven Ignore security , No longer verify the server's certificate ( At this time, the server's certificate may be replaced ).
mvn -Dmaven.wagon.http.ssl.insecure=true package
* Method 2: Add certificate to cacerts in
Environmental Science :Windows.
cacerts It contains a lot of CA certificate , Position in Java Installation directory : 『Java\jdk1.8.0_65\jre\lib\security\cacerts』.
Execute the following command , Add certificate to cacerts in :
keytool.exe -importcert -file < New certificate > -keystore Java\jdk1.8.0_65\jre\lib\security\cacerts -storepass changeit
< New certificate >
It can be cer Format , for example ,xxx.cer.
Executing this command will prompt you if you trust this certificate , Input yes, enter . Then the certificate is added cacerts It's in . part log as follows :
Trust this certificate? [no]: yes
Certificate was added to keystore
◇ About cacerts Explanation
Reference resources : https://www.ibm.com/support/knowledgecenter/SSYKE2_8.0.0/com.ibm.java.security.component.80.doc/security-component/keytoolDocs/cacertsfile.html
A certificates file named “cacerts” resides in the security properties directory, java.home\lib\security, where java.home is the runtime environment directory (the jre directory in the SDK or the top-level directory of the Java 2 Runtime Environment).
The “cacerts” file represents a system-wide keystore with CA certificates. System administrators can configure and manage that file using keytool, specifying “jks” as the keystore type. The “cacerts” keystore file ships with several root CA certificates. The initial password of the “cacerts” keystore file is “changeit”. System administrators should change that password and the default access permission of that file when installing the SDK.
* Reference resources
版权声明
本文为[Love blog uncle]所创,转载请带上原文链接,感谢
https://yzsam.com/2022/04/202204231102106386.html
边栏推荐
- FileProvider 路径配置策略的理解
- 学习 Go 语言 0x01:从官网开始
- More reliable model art than deep learning
- Learning notes 7-depth neural network optimization
- 第六站神京门户-------手机号码的转换
- VIM + ctags + cscope development environment construction guide
- CUMCM 2021-B:乙醇偶合制備C4烯烴(2)
- 语雀文档编辑器将开源:始于但不止于Markdown
- Visual solutions to common problems (VIII) mathematical formulas
- Mysql中一千万条数据怎么快速查询
猜你喜欢
随机推荐
@valid,@Validated 的学习笔记
Cumcm 2021 - B: préparation d'oléfines C4 par couplage éthanol (2)
Mysql系列SQL查询语句书写顺序及执行顺序详解
Common parameters of ffmpeg command line
Excel·VBA自定义函数获取单元格多数值
Visual common drawing (V) scatter diagram
colab
VScode
How to bind a process to a specified CPU
Visual common drawing (IV) histogram
MySQL分区表实现按月份归类
Manjaro installation and configuration (vscode, wechat, beautification, input method)
Mba-day5 Mathematics - application problems - engineering problems
mysql插入datetime类型字段不加单引号插入不成功
Latex usage
Mysql中一千万条数据怎么快速查询
Learning notes 7-depth neural network optimization
学习 Go 语言 0x08:《Go 语言之旅》中 练习使用 error
Data analysis learning (I) data analysis and numpy Foundation
MySQL Router重装后重新连接集群进行引导出现的——此主机中之前已配置过的问题