【发布时间】:2014-02-02 15:23:55
【问题描述】:
我正在尝试使用 SSL 做一个 API。当我执行呼叫时,我收到以下错误:
org.springframework.web.client.ResourceAccessException: I/O error on GET request for "https://yyyyy.zzz/123":sun.security.validator.ValidatorException: PKIX path building failed: sun.security.provider.certpath.SunCertPathBuilderException: unable to find valid certification path to requested target; nested exception is 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
我知道 StackOverflow 中有很多关于这个问题的问题,但我看到的问题是因为证书是自签名的。在这种情况下,证书是有效的,并且浏览器可以毫无问题地将其识别为有效证书。
所以我的问题是,为什么从 Java 调用时会失败,而在使用浏览器时却运行良好?
【问题讨论】: