zoukankan      html  css  js  c++  java
  • java程序中访问https时,报 PKIX path building failed: sun.security.provider.certpath.SunCertPathBuilderException: unable to find valid certification path to requested target

    在java中使用https访问数据时报异常:

    Caused by: sun.security.validator.ValidatorException: PKIX path building failed: sun.security.provider.certpath.SunCertPathBuilderException: unable to find valid certification path to requested target

    需要使用keytool工具,将对应域名的证书导入到jdk的cacerts中,这个证书可以是*.crt,*.cer等证书

    cacerts包含了很多CA证书,位置在Java的安装目录: Javajdk1.8.0_181jrelibsecuritycacerts

    执行如下命令,可将证书导入到cacerts中,使其成为可信证书:

    cd D:IDEJavajdk1.8.0_181jrelibsecurity
    keytool -importcert -alias httpfs -keystore cacerts -file D:IDEJavajdk1.8.0_181jrelibsecurityssl.cer

    需要输入cacerts证书库密码:changeit

    如果没有证书,可以使用Chrome浏览器访问https域名,下载对应的证书,详情请参照:https://blog.csdn.net/qq_31222053/article/details/94174506

  • 相关阅读:
    双端队列
    顺序循环队列
    顺序队列
    Counting Triangles(hd1396)
    蒟蒻之栈模拟递归
    链栈以及顺序栈应用—算数表达式
    栈的简单应用-进制转换
    链栈
    共享栈
    顺序栈
  • 原文地址:https://www.cnblogs.com/qixing/p/11883494.html
Copyright © 2011-2022 走看看