Error : java.security.cert.CertificateException: Illegal given domain name: abc_xyz.stg.myweb.com

后端 未结 3 1921
温柔的废话
温柔的废话 2020-12-21 03:38

Hi team i found below exception when calling an api

https://abc_xyz.stg.myweb.com/api/AuthorizedUser?username=admin&password=admin

ja

相关标签:
3条回答
  • 2020-12-21 04:20

    In case someone see this issue again and don't want to change jdk version, it is possible to disable the SSL Host name verification (and it is not the good solution but sometimes it is not possible to avoid this..) :

        HttpsURLConnection.setDefaultHostnameVerifier(new HostnameVerifier() {
            public boolean verify(String hostname, SSLSession session) {
                return true;
            }
        });
    
    0 讨论(0)
  • 2020-12-21 04:30

    In case anyone see this issue again. This issue is caused by an old jdk that thinks an underscore is invalid as the sub domain name, which in a later version has been removed from the jdk. So in short upgrade jdk version will solve this issue.

    0 讨论(0)
  • 2020-12-21 04:33

    I had the same issue, and couldn't update jdk nor wanted disable ssl host name verification. Changing the underscore character in the name to a dash ('-' instead of '_') worked perfectly. Apparently dash and underscore are evaluated the same.

    0 讨论(0)
提交回复
热议问题