title: clojure - java interop (No matching ctor found)
body: <p>Consider the following lines of Java code:</p>
  
  <pre><code>final WebClient webClient = new WebClient()
  final HtmlPage page = webClient.getPage("http://htmlunit.sourceforge.net");
  </code></pre>
  
  <p>(taken from the 'Getting Started' Example of the the  <a href="http://htmlunit.sourceforge.net/gettingStarted.html" rel="nofollow">HTML Unit Project</a>)</p>
  
  <p>How would that be adopted to Clojure?</p>
  
  <p>After adding the needed dependencies, I tried the following:</p>
  
  <pre><code>(import '[com.gargoylesoftware.htmlunit.html HtmlPage])
  (import '[com.gargoylesoftware.htmlunit WebClient])
  
  (let [wc (WebClient.)
        hp (HtmlPage. (.getPage wc "http://www.something.."))]
     ;;...)
  </code></pre>
  
  <p>but I get this error:</p>
  
  <pre><code>CompilerException java.lang.IllegalArgumentException: No matching ctor found f\
  or class com.gargoylesoftware.htmlunit.html.HtmlPage, compiling:(*cider-repl l\
  ocalhost*:30:16) 
  </code></pre>
  
  <p>Anybody knows why?</p>
  
  <hr>
  
  <p><strong>EDIT:</strong></p>
  
  <p>As noted in a comment, calling the constructor of HtmlPage might not be necessary. However the following code yields an error as well, though another one:</p>
  
  <pre><code>    (.getPage (WebClient.) "http://htmlunit.sourceforge.net")
  
  IllegalArgumentException Cannot locate declared field class org.apache.http.im\
  pl.client.HttpClientBuilder.dnsResolver  org.apache.commons.lang3.Validate.isT\
  rue (Validate.java:155) 
  </code></pre>