title: java.lang.NoSuchFieldError: INSTANCE
body: <p>When trying to submit my topology through StormSubmitter, I am getting - </p>
  
  <pre><code>Caused by: java.lang.NoSuchFieldError: INSTANCE  
  at org.apache.http.impl.io.DefaultHttpRequestWriterFactory.&lt;init&gt;(DefaultHttpRequestWriterFactory.java:52)
  </code></pre>
  
  <p>I am using Spring.</p>
  
  <p>I am not initializing HttpClient in Spout/Bolt Constructor. Instead its initialized in constructor of a class that is being fetched from Spring Context in <code>prepare()</code> method of bolt</p>
  
  <p>Code is structured as follows -</p>
  
  <p><strong>SomeBolt.java</strong></p>
  
  <pre><code>@Component
  public class SomeBolt extends BaseRichBolt {
      private OutputCollector _collector;
      private SomeClient someClient;
  
      @Override
      public void prepare(Map conf, TopologyContext context, OutputCollector collector) {
          _collector = collector;
          someClient = AppContext.getBean(SomeClient.class);
      }
  }
  </code></pre>
  
  <p><strong>SomeClient.java</strong></p>
  
  <pre><code>@Component
  public class SomeClient {
      private final CloseableHttpClient httpClient;
  
      public SomeClient() {
          this.httpClient = (httpClient == null ? HttpClients.createDefault() : httpClient);
      }
  }
  </code></pre>
  
  <p><strong>AppContext.java</strong></p>
  
  <pre><code>@Component
  public class AppContext implements ApplicationContextAware {
  
      private static ApplicationContext applicationContext;
  
      @Override
      public void setApplicationContext(ApplicationContext applicationContext) throws BeansException {
          AppContext.applicationContext = applicationContext;
      }
  
      public static &lt;T&gt; T getBean(Class&lt;T&gt; c) {
          return applicationContext.getBean(c);
      }
  }
  </code></pre>