httpclient访问https
时间: 2023-08-03 18:09:15 浏览: 132
HttpClient访问https站点时,需要注意证书的处理。有几种方法可以解决这个问题。方法一是将站点的证书导入到Java的证书库文件中。方法二是在HttpClient访问时使用网站的证书进行访问。方法三是在HttpClient访问https站点时忽略认证。方法四是在HttpClient访问https站点时信任所有证书。如果JRE或者JDK没有导入某个站点的证书,那么在访问时会报错,错误信息可能是"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"。\[1\]\[2\]\[3\]
#### 引用[.reference_title]
- *1* *2* *3* [HttpClient 使用证书访问https站点](https://blog.csdn.net/oscar999/article/details/123016797)[target="_blank" data-report-click={"spm":"1018.2226.3001.9630","extra":{"utm_source":"vip_chatgpt_common_search_pc_result","utm_medium":"distribute.pc_search_result.none-task-cask-2~all~insert_cask~default-1-null.142^v91^control,239^v3^insert_chatgpt"}} ] [.reference_item]
[ .reference_list ]
阅读全文