CertificateException: No name matching ssl.someUrl.de found

后端 未结 7 1823
生来不讨喜
生来不讨喜 2020-11-29 21:22

I\'m trying to connect to one of my servers through ssl, with Java. I tried a lot of options here is my best try:

I generate a jssecacerts with the recommendet scrip

7条回答
  •  暗喜
    暗喜 (楼主)
    2020-11-29 22:10

    I've found a good resolution here: http://www.mkyong.com/webservices/jax-ws/java-security-cert-certificateexception-no-name-matching-localhost-found/

    But my problem was a little bit different and solved it differently.

    The web service was on remote host. For example: https://some.remote.host/MyWebService?wsdl

    But it was available only by IP for any clients, but certificate was created for domain: some.remote.host (CN=some.remote.host). And this domain can't be resolved by IP because it is not presented in DNS).

    So the same problem appeared: if I use IP to connect to web service by ssl, it can't be reached becase certificate CN=some.remote.host and it is not equal to host name I've specified (i.e. host IP).

    I've resolved it by matching this hostname with IP in /etc/hosts file. The problem was fixed.

    But in case when the Web Service is hosted on localhost app server, it think, it should be solved like mkyong described in his article.

提交回复
热议问题