• Register
0 votes
197 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

Please log in or register to answer this question.

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 63 views
63 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, 2020 jwilliam 3.9k points
0 votes
1 answer 4 views
4 views
Problem: Getting this error .. anyone knows the solution of it? No subject alternative dns name matching
asked May 2 Ifra 37.2k points
0 votes
1 answer 14 views
0 votes
1 answer 2 views
2 views
Problem: Is there an efficient way to resolve this > Sun.security.validator.validatorexception: pkix path building failed:
asked 2 days ago ummeshani 10.8k points
0 votes
1 answer 24 views
24 views
Problem: java.security.cert.certpathvalidatorexception: trust anchor for certification path not found.
asked Feb 19 Lucky Guy 1.5k points
0 votes
1 answer 3 views
3 views
Problem: I am unable to fix it. > Revocation information for the security certificate lol
asked 1 day ago Junia Phoebe 15.3k points
0 votes
1 answer 7 views
7 views
Problem: Is anyone available to assist me and resolve this issue > The security certificate presented by this website was issued for a different website's address
asked Apr 23 ummeshani 10.8k points
0 votes
2 answers 363 views
363 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 211 views
211 views
Problem : I can push by clone project using ssh but it is not working for me getting following error server certificate verification failed. cafile: /etc/ssl/certs/ca-certificates.crt crlfile: none
asked Nov 12, 2019 peterlaw 6.9k points