Java PKIX路径生成失败,但我接受所有密码套件

Java PKIX路径生成失败,但我接受所有密码套件,java,bouncycastle,okhttp3,Java,Bouncycastle,Okhttp3,我正在尝试与OkHttp 3建立Http连接 我有: 这似乎有效,但偶尔我也会这样 SSLHandshakeException: sun.security.validator.ValidatorException: PKIX path building failed: sun.security.provider.certpath.SunCertPathBuilderException: unable to find valid certification path to requested ta

我正在尝试与OkHttp 3建立Http连接 我有:

这似乎有效,但偶尔我也会这样

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

有什么办法可以解决这个问题吗

密码套件和证书验证(包括路径构建)几乎完全无关;你的问题是:我的车没有轮子,甚至在我加满油箱的时候也不能正常行驶。解决证书路径问题的方法首先是查看证书路径(如果是非标准的,则查看您的信任库),而您根本不提供有关该路径的任何信息。有很多方法;对于j7+来说,最简单的方法可能是
keytool-printcert-sslserver$servername[:port]
@dave\u thompson\u 085是否有办法通过编程方式添加这些内容?我将在AWS中运行这个,并且没有访问他们JVM的权限。
SSLHandshakeException: sun.security.validator.ValidatorException: PKIX path building failed: sun.security.provider.certpath.SunCertPathBuilderException: unable to find valid certification path to requested target