关闭

Cannot locate declared field class org.apache.http.impl.client.HttpClientBuilder.dnsResolver

瞎溜达 1年前 ⋅ 549 阅读
htmlunit,webClient.getPage(url)报错
Exception in thread "main" java.lang.IllegalArgumentException: Cannot locate declared field class org.apache.http.impl.client.HttpClientBuilder.dnsResolver
	at org.apache.commons.lang3.Validate.isTrue(Validate.java:158)
	at org.apache.commons.lang3.reflect.FieldUtils.readDeclaredField(FieldUtils.java:511)
	at com.gargoylesoftware.htmlunit.HttpWebConnection.getField(HttpWebConnection.java:1091)
	at com.gargoylesoftware.htmlunit.HttpWebConnection.createConnectionManager(HttpWebConnection.java:1014)
	at com.gargoylesoftware.htmlunit.HttpWebConnection.getResponse(HttpWebConnection.java:176)
	at com.gargoylesoftware.htmlunit.WebClient.loadWebResponseFromWebConnection(WebClient.java:1368)
	at com.gargoylesoftware.htmlunit.WebClient.loadWebResponse(WebClient.java:1285)
	at com.gargoylesoftware.htmlunit.WebClient.getPage(WebClient.java:387)
	at com.gargoylesoftware.htmlunit.WebClient.getPage(WebClient.java:309)
	at com.gargoylesoftware.htmlunit.WebClient.getPage(WebClient.java:456)
	at com.gargoylesoftware.htmlunit.WebClient.getPage(WebClient.java:441)
​

将httpclient改为4.5.2

<dependency>
	<groupId>org.apache.httpcomponents</groupId>
	<artifactId>httpclient</artifactId>
	<version>4.5.2</version>
</dependency>

 


全部评论: 0

    我有话说: