Vadivelan created HTTPCLIENT-2128:
-------------------------------------
Summary: SSL Error
Key: HTTPCLIENT-2128
URL: https://issues.apache.org/jira/browse/HTTPCLIENT-2128
Project: HttpComponents HttpClient
Issue Type: Bug
Components: HttpClient (classic)
Affects Versions: 4.5.6
Reporter: Vadivelan
Fix For: Future
I am using "httpclient" jar to connect external api, and write the below code
for HTTP connection settings.
Getting "SSLPeerUnverifiedException" exception while connecting to API, refer
the below code and advice me what is the issue in my code and help me to avoid
this hostname verifier issue.
JAR:
<dependency>
<groupId>org.apache.httpcomponents</groupId>
<artifactId>httpclient</artifactId>
<version>4.5.6</version>
</dependency>
CODE:
httpClient = HttpClients.custom()
.disableAutomaticRetries()
.disableAuthCaching()
.setConnectionManager(poolingHttpClientConnectionManager)
.setSSLHostnameVerifier(new NoopHostnameVerifier())
.setSSLSocketFactory(sslConnectionSocketFactory)
.setDefaultRequestConfig(requestConfig)
.build();
Error Message:
I/O error on POST request for "<URL>": Certificate for <Server Name> doesn't
match any of the subject alternative names: [Server Name]; nested exception is
javax.net.ssl.SSLPeerUnverifiedException: Certificate for <Server Name> doesn't
match any of the subject alternative names: [<Server Name>] ,
[org.springframework.web.client.RestTemplate.doExecute(RestTemplate.java:748),
org.springframework.web.client.RestTemplate.exchange(RestTemplate.java:641),
--
This message was sent by Atlassian Jira
(v8.3.4#803005)
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]