You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@hc.apache.org by "Michael Osipov (Jira)" <ji...@apache.org> on 2020/11/17 16:27:00 UTC
[jira] [Commented] (HTTPCLIENT-2128) SSL Error
[ https://issues.apache.org/jira/browse/HTTPCLIENT-2128?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17233708#comment-17233708 ]
Michael Osipov commented on HTTPCLIENT-2128:
--------------------------------------------
Update first.
> 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
> Priority: Major
> 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: dev-unsubscribe@hc.apache.org
For additional commands, e-mail: dev-help@hc.apache.org