• Register
Welcome to Kodlogs, programming questions and answer website.
0 votes
22 views

Problem : 

I have a Java web service client, which consumes a web service via HTTPS.
When I connect to the service URL, I get the exception 
java.security.cert.CertificateException: No subject alternative names present.
by (6.9k points)  

1 Answer

0 votes

Solution :

I have also faced the same issue and resolved it with bellow code.One must put this code before the first call to webservices.

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

Further Readings:

https://www.ibm.com/support/knowledgecenter/en/SS9J9E/ioc/ts_liberty_ip.html

by (33.3k points)  
edited by
...