4

I'm trying just do this:

WebClient webClient = new WebClient();
HtmlPage loginPage = webClient.getPage("https://www.google.com.br");

But I'm getting this error:

 java.lang.IllegalArgumentException: Cannot locate declared field class org.apache.http.impl.client.HttpClientBuilder.dnsResolver

I'm using Liferay DXP with Gradle.

How can I solve this problem?

Regards

Ole V.V.
  • 81,772
  • 15
  • 137
  • 161
cmsantos
  • 317
  • 1
  • 4
  • 13
  • in your IDE can you open that class? Most likely it is due to Version Mismatch (you are using a version which does not have that class). Figure out all the dependencies and where that class exists. or there was an error in the constructor of that class (less likely) – Bojan Petkovic Mar 24 '17 at 19:29
  • Try HttpClient to be over 4.5. – Bojan Petkovic Mar 24 '17 at 19:33
  • which classe @BojanPetkovic ? – cmsantos Mar 24 '17 at 19:41
  • HttpClientBuilder. You are likely linking to two versions of HttpClient library in your code. figure out which httpClient library versions you have. If it is below 4.5 try and upgrade it. – Bojan Petkovic Mar 24 '17 at 20:02
  • I'm using like this: compile group: 'org.apache.httpcomponents', name: 'httpclient', version: '4.5.3' but I don't know if other library is importing other version.. – cmsantos Mar 24 '17 at 20:47
  • 1
    you need to check dependency tree and figure out which version is exactly being pulled in. – Bojan Petkovic Mar 24 '17 at 20:49
  • did you solve this issue ? I'm using htmlunit 2.70.0 and still facing this problem – vikramvi Feb 25 '23 at 10:55

0 Answers0