when i want to invoke https webservice by certificate(keystore.jks) .

i get this exception

 java.security.cert.CertificateException: No subject alternative names present

ip of webservice is 192.168.1.10 but certificate is created for 192.168.1.20

java check this in client and throw this exception 

i add host for 192.168.1.20  in my os and add this line in application

this code disable this check


javax.net.ssl.HttpsURLConnection.setDefaultHostnameVerifier(
                new javax.net.ssl.HostnameVerifier(){
            
                    public boolean verify(String hostname,
                            javax.net.ssl.SSLSession sslSession) {
                        if (hostname.equals("azizkhanihost")) {
                            return true;
                        }
                        return false;
                    }
        });