title: ClosableHttpClient - getting Exception "java.lang.NoSuchFieldError: INSTANCE"
body: <p>I am working on a small browser implementation in Java.</p>
  
  <p>I'm using Apache HttpComponents 4.3.1, because it has an automatic forward mechanism, but I am having trouble figuring out how it really works.</p>
  
  <p>From the Apache docs <a href="https://hc.apache.org/httpcomponents-client-ga/tutorial/html/" rel="nofollow noreferrer">Chapter 1. Fundamentals</a>, I am trying to use this code excerpt:</p>
  
  <pre><code>LaxRedirectStrategy redirectStrategy = new LaxRedirectStrategy();
  CloseableHttpClient httpclient = HttpClients.custom()
          .setRedirectStrategy(redirectStrategy)
          .build();
  </code></pre>
  
  <p>This should create a <code>ClosableHttpClient</code> which can use automatically forward. But on the 2nd line (where the client is created by calling <code>.build()</code>) I get this error:</p>
  
  <blockquote>
    <p>Exception in thread "AWT-EventQueue-0" java.lang.NoSuchFieldError:<br>
    INSTANCE  at
    org.apache.http.impl.io.DefaultHttpRequestWriterFactory.&lt;init&gt;<br>
    (DefaultHttpRequestWriterFactory.java:52)</p>
  </blockquote>
  
  <p>There is not more code, i just call this code snippet via:</p>
  
  <pre><code>HttpClient myClient = createClient();
  </code></pre>
  
  <p>It makes no difference if I am using explicit:</p>
  
  <pre><code>ClosableHttpClient myClient = createClient();
  </code></pre>
  
  <p><em>(which I found in the <a href="https://hc.apache.org/httpcomponents-client-ga/tutorial/html/fundamentals.html#d5e321" rel="nofollow noreferrer">Apache Tutorial</a>)</em></p>
  
  <p>I suspect that some library is interfering, so here is my classpath overview:</p>
  
  <p><img src="https://i.stack.imgur.com/yEtUE.jpg" alt="My Classpath"></p>