这对我来说是一个难题。下面显示了当我尝试进行亚马逊搜索时抛出异常的代码部分:
AWSECommerceServiceLocator locator = new AWSECommerceServiceLocator(fooConfig);
locator.setAWSECommerceServicePortEndpointAddress(SourceCountry.USA.getPortAddress());
//throws exception
AWSECommerceServicePortType type = locator.getAWSECommerceServicePort();
异常(exception)情况如下:
NativeException: bc.exceptions.FatalException: 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
奇怪的是,这种情况间歇性地发生。有时,一切都很完美。有人有什么想法吗?此时,我们非常感谢任何帮助。
谢谢。
最佳答案
可能有几个根本原因:
- 过时的 java 安装,不包含某些 Amazon 服务器的有效根证书
- 无效的服务器端证书,不受任何有效颁发者信任
要从客户端调试到控制台,请将 -Djavax.net.debug=all
添加到命令行。页面Debugging SSL/TLS connections可以深入了解潜在的错误。
关于java - 亚马逊 : SSLHandshakeException happening intermittently,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/12356290/