Java 客户端无法使用 SSL over HTTPS 访问 Web 服务
我们有一个简单的 Java Web 应用程序,运行在 WebLogic 上,通过 https 进行 SSL 保护。服务器的名称是 dev-service1。使用带有 https 的浏览器访问 Web 应用程序工作正常,但是,使用独立的 Java 客户端时,我们会收到以下错误,表明在 client.jks 文件中找不到“dev-service1”。
com.sun.xml.internal.ws.client.ClientTransportException:
HTTP transport error: javax.net.ssl.SSLHandshakeException: java.security.cert.CertificateException:
No name matching dev-service1 found
at com.sun.xml.internal.ws.transport.http.client.HttpClientTransport.getOutput(HttpClientTransport.java:121)
我们是否必须使用Java的keytool从server.jks文件中导出一个新的client.jks文件?
We have a simple web application in Java running on WebLogic secured with SSL over https. The name of the server is dev-service1. Access to the web app using a browser with https works fine, however, with a standalone Java client we are getting the following error indicating that the "dev-service1" is not found in the client.jks file.
com.sun.xml.internal.ws.client.ClientTransportException:
HTTP transport error: javax.net.ssl.SSLHandshakeException: java.security.cert.CertificateException:
No name matching dev-service1 found
at com.sun.xml.internal.ws.transport.http.client.HttpClientTransport.getOutput(HttpClientTransport.java:121)
Do we have to export a new client.jks file from the server.jks file using Java's keytool?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您需要将服务器上的自签名证书添加到客户端信任库中。
我建议使用 InstallCert 程序,该程序可以在 one 中找到="http://blogs.oracle.com/andreas/entry/no_more_unable_to_find" rel="nofollow">两个地方。
快速注释。我相当确定上述程序不会将服务器的证书添加到 java 附带的默认信任库中。因此,您必须在用于启动客户端的命令行中设置 -Djavax.net.ssl.trustStore 和 -Djavax.net.ssl.trustStorePassword VM 参数。
You will need to add the self-signed certificate from the server into your clients truststore.
I would recommend using the InstallCert program that can be found in one of two places.
Quick note. I'm fairly sure that the above programs will NOT add the certificate from the server to your default truststore that ships with java. So you will have to set the -Djavax.net.ssl.trustStore and -Djavax.net.ssl.trustStorePassword VM Arguments in your command line that you use to start your client.