• Register
0 votes
108 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.
6 5 3
6,930 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

9 7 4
38,600 points

Related questions

0 votes
1 answer 47 views
47 views
Problem : I have the Java web service client, which consumes the web service via HTTPS. When I try to connect to the service URL (https://AAA.BBB.CCC.DDD:9443/ISomeService ), I get the exception as below: “ Java.security.cert.CertificateException: No subject alternative names present.”
asked Jan 21 jwilliam 3.9k points
0 votes
2 answers 190 views
190 views
Problem : I am getting bellow error while using keytool keytool error: java.lang.exception: public keys in reply and keystore don't match
asked Oct 19, 2019 peterlaw 6.9k points
0 votes
2 answers 272 views
272 views
Problem : I am trying to consume a RESTful service from url https://someurl.com. But I am getting the following error: java security cert certpathvalidatorexception certificate chaining error
asked Oct 23, 2019 peterlaw 6.9k points
0 votes
1 answer 246 views
246 views
Problem : I have a java complied package and it is sopposed to communicate with https server on net. But when i try running the compilation gives the following exception: javax.net.ssl.sslexception: unrecognized ssl message, plaintext connection?
asked Oct 23, 2019 peterlaw 6.9k points