在用httpclient-4.5.2调用http接口的时候build一个CloseableHttpClient的时候,我的代码是:
RequestConfig config = RequestConfig.custom()
config.set......
CloseableHttpClient httpClient = HttpClients.custom().setDefaultRequestConfig(config).build();
报错:
ClassNotFound:org/apache/http/ssl/SSLContexts
是说这个SSLContexts找不到了,我看了代码里引入的路径是:
import org.apache.http.ssl.SSLContexts;
这个类是在httpcore包里的,我打开了httpcore-4.3.5(maven的pom里我支配了httpclient-4.5.2)这个jar包是自动加载的。我打开看里面并没有ssl这个路径。官网看他的API:
将httpcore的版本升级到4.4就OK了。