- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
我低于异常
sun.security.validator.ValidatorException: PKIX path building failed: sun.security.provider.certpath.SunCertPathBuilderException: unable to find valid certification path to requested target
我已经在该位置设置了SSL证书
C:\Program Files\AdoptOpenJDK\jdk-11.0.9.11-hotspot\lib\security
keytool -import -keystore cacerts -file C:\Users\test\Desktop\Certificate\oCertificate.cer
但是我在访问服务器时遇到了上述异常。
我看到的结果我已将证书添加到 Jdk cacerts 文件中,但它工作了两天后又出现了同样的错误。我无法让它正常工作我能够成功地 ping 服务器而不是它再次显示异常。
最佳答案
您描述的问题是运行 keytool 导入证书给您这个错误吗?请提供选项 -trustcacerts
并查看相关文档:
Import a New Trusted Certificate
Before you add the certificate to the keystore, the keytool commandverifies it by attempting to construct a chain of trust from thatcertificate to a self-signed certificate (belonging to a root CA),using trusted certificates that are already available in the keystore.
If the -trustcacerts option was specified, then additionalcertificates are considered for the chain of trust, namely thecertificates in a file named cacerts.
If the keytool command fails to establish a trust path from thecertificate to be imported up to a self-signed certificate (eitherfrom the keystore or the cacerts file), then the certificateinformation is printed, and the user is prompted to verify it bycomparing the displayed certificate fingerprints with the fingerprintsobtained from some other (trusted) source of information, which mightbe the certificate owner. Be very careful to ensure the certificate isvalid before importing it as a trusted certificate. The user then hasthe option of stopping the import operation. If the -noprompt optionis specified, then there is no interaction with the user.
来源:https://docs.oracle.com/en/java/javase/11/tools/keytool.html
或者,您可能会发现 keytool 不是非常用户友好,您可能会喜欢其他软件,例如:https://keystore-explorer.org/downloads.html更多。
或者如果问题是您的(TLS 客户端,甚至是 TLS 服务器)软件有一些证书问题,它可能是因为 jccampanero 已经建议服务器可能已切换到不同的证书,或者据我所知服务器实际上可能是负载均衡器后面的几个不同的服务器,这些服务器可能并不都具有相同的证书。 (或者您可能安装了一些替换默认 cacerts 文件的 Java 更新?)
如果出现问题,我强烈建议阅读 JSSE 文档并使用 java 选项启用调试日志记录 -Djavax.net.debug=all
或者可能比 all
喜欢 handshake
请参阅 Java 11 文档:
这显示了您的应用程序使用的确切 TrustStore、服务器在握手期间提供的证书以及作为 TLS 握手一部分的许多其他协商内容。
如果您希望完全控制您信任的人来颁发证书,您可以配置自己的信任库,而不是可以使用 Java 安装之外的默认信任库,选项如下:
java -Djavax.net.ssl.trustStore=samplecacerts \
-Djavax.net.ssl.trustStorePassword=changeit \
Application
我相信研究此调试日志记录应该可以直接解决问题,如果不能,请向我们提供一些相关的日志记录。
关于java - 太阳.security.validator.ValidatorException : SunCertPathBuilderException -while importing certificate,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/66868258/
在过去的几天里,我们在上传到 Google Cloud Storage 时遇到了以下异常: javax.net.ssl.SSLHandshakeException:PKIX 路径构建失败:sun.se
我需要使用一些 HTTPS 网络服务。要使用证书,我正在设置 (javax.net.ssl) trustStore、trustStorePassword、keyStore 和 keyStorePass
我正在尝试通过 ssl 连接到 ldap 服务器,我获得了服务器证书并按如下方式安装了它: keytool -keystore cacerts -importcert -alias ldapCert
我有一个在 Glassfish 服务器上与 Jersey 一起运行的 Java Rest API,我使用 Firebase Auth 来验证我的用户。所以我使用 Firebase Admin SDK
在我们的组织中,我们使用内部 Artifactory 服务器作为 Maven 存储库。我已经相应地设置了 Maven 设置。问题是当我从 Eclipse 执行 Maven > Update 时,会抛出
当我尝试使用 SBT 时,某些文件无法下载并出现以下错误: Server access Error: sun.security.validator.ValidatorException: PKIX p
我不太习惯 java 世界,所以我不确定我的问题是在我的 Azure 设置上,还是在 java 设置上。在尝试下面的教程后,我遇到了以下异常。 https://learn.microsoft.com/
我正在使用 maven-jaxb2 来生成类来调用 Web 服务。 org.jvnet.jaxb2.maven2 maven-jaxb2-plugin 0.12.3
我们使用 clj-http 以及由带有自签名证书的 keystore.pfx 组成的 keystore : (let [url (str url "api/fetch") opts {:k
这个问题已经有答案了: "PKIX path building failed" and "unable to find valid certification path to requested ta
我正在尝试连接到 MySQL 数据库: static final String URL="jdbc:mysql://localhost:3306/demo_hotels?useSSL=t
我正在使用 restTemplate 通过 SSL 请求发布。问题是我无法通过 SSL 向服务器发送发布请求。我正在使用自签名证书进行通信。然而,奇怪的是,当我通过 SSL 发送获取请求时,它工作正常
我最近获得了一个网站的新证书,并按照建议使用 SHA-2 签名算法生成了它。一切看起来都很好,直到我尝试用 Java (java.net.URLConnection) 建立到该网站的安全连接,这导致了
我正在使用以下测试代码连接到 ldap 服务器。它在 Windows 上工作正常,但在 Linux 上,当我第一次尝试运行程序时它会连接,然后第二次它会抛出异常,第三次尝试它会成功连接等等(即奇数执行
我有一个类将从 https 服务器下载文件。当我运行它时,它会返回很多错误。看来我的证书有问题。是否可以忽略客户端-服务器身份验证?如果是,怎么办? package com.da; import ja
我有一个类将从 https 服务器下载文件。当我运行它时,它会返回很多错误。看来我的证书有问题。是否可以忽略客户端-服务器身份验证?如果是,怎么办? package com.da; import ja
我有一个类将从 https 服务器下载文件。当我运行它时,它会返回很多错误。看来我的证书有问题。是否可以忽略客户端-服务器身份验证?如果是,怎么办? package com.da; import ja
我有一个类将从 https 服务器下载文件。当我运行它时,它会返回很多错误。看来我的证书有问题。是否可以忽略客户端-服务器身份验证?如果是,怎么办? package com.da; import ja
我有一个类将从 https 服务器下载文件。当我运行它时,它会返回很多错误。看来我的证书有问题。是否可以忽略客户端-服务器身份验证?如果是,怎么办? package com.da; import ja
为了对我的 xmpp 堆栈进行集成测试,我在本地主机上设置了一个 vysper 服务器 (0.7)。现在我想使用版本 4.0.2 中的 smack-core 和 smack-tcp 连接到服务器。 问
我是一名优秀的程序员,十分优秀!