报错 org.apache.http.ProtocolException: Target host is not specified

org.apache.http.ProtocolException: Target host is not specified

对于httpClient4.3访问指定页面,对于URL必须使用 http://开始,否则会有报错信息:org.apache.http.ProtocolException: Target host is not specified

形如在下面的uriBuilder中的百度链接要以“http://”开头

CloseableHttpClient client=HttpClients.createDefault();  
    //2,创建uriBuilder 对于httpClient4.3访问指定页面url必须要使用http://开始  
    URIBuilder uriBuilder=new URIBuilder("http://www.baidu.com");  

参考资料:

1、org.apache.http.ProtocolException: Target host is not specified

https://blog.csdn.net/csdnliuxin123524/article/details/78337086?locationNum=3&fps=1

你可能感兴趣的:(Java基础)