我通过 SSL 证书使用 Axis 实现调用 Web 服务。我使用 key 工具将证书添加到我的 keystore 。
它显示为“证书已添加到 keystore ”。但是当我运行 java 程序时,出现以下异常
AxisFault
故障代码:{ http://schemas.xmlsoap.org/soap/envelope/ }Server.userException 故障子代码: faultString:javax.net.ssl.SSLHandshakeException:sun.security.validator.ValidatorException:PKIX 路径构建失败:sun.security.provider.certpath.SunCertPathBuilderException:无法找到请求目标的有效证书路径 故障 Actor : 故障节点: 故障详情: { http://xml.apache.org/axis/ }stackTrace:javax.net.ssl.SSLHandshakeException: sun.security.validator.ValidatorException: PKIX 路径构建失败: sun.security.provider.certpath.SunCertPathBuilderException: 无法找到请求目标的有效证书路径 在 sun.security.ssl.Alerts.getSSLException(未知来源) 在 sun.security.ssl.SSLSocketImpl.fatal(未知来源) 在 sun.security.ssl.Handshaker.fatalSE(未知来源) 在 sun.security.ssl.Handshaker.fatalSE(未知来源) 在 sun.security.ssl.ClientHandshaker.serverCertificate(未知来源) 在 sun.security.ssl.ClientHandshaker.processMessage(未知来源) 在 sun.security.ssl.Handshaker.processLoop(未知来源) 在 sun.security.ssl.Handshaker.process_record(未知来源) 在 sun.security.ssl.SSLSocketImpl.readRecord(未知来源) 在 sun.security.ssl.SSLSocketImpl.performInitialHandshake(未知来源) 在 sun.security.ssl.SSLSocketImpl.startHandshake(未知来源) 在 sun.security.ssl.SSLSocketImpl.startHandshake(未知来源) 一个
有关如何在调用 Web 服务 Axis 时导入 SSL 证书的任何建议
最佳答案
问题可能是证书链未正确导入 cacerts 文件。 服务器身份验证部分应该很容易。只需将所需的证书粘贴到提供的 cacerts 信任库中即可。
看这个http://docs.oracle.com/javase/1.5.0/docs/tooldocs/solaris/keytool.html有关使用 keytool 与 cacerts 信任库一起工作的一些信息。
关于web-services - 使用 SSL 的轴客户端调用,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/24274250/