# NoClassDefFoundError HttpAsyncResponseConsumer

**URL:** https://discuss.elastic.co/t/noclassdeffounderror-httpasyncresponseconsumer/64231
**Category:** Elasticsearch
**Created:** [October 28, 2016, 4:13am UTC](https://discuss.elastic.co/t/noclassdeffounderror-httpasyncresponseconsumer/64231 "2016-10-28T04:13:28Z")
**Posts on this page:** 5
**Page:** 1

<div class="post-metadata">

### Author: ![Sharat\_Jagannath](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/sharat_jagannath/32/24299_2.png) [@Sharat\_Jagannath](https://discuss.elastic.co/u/Sharat_Jagannath)
#### Post date: [October 28, 2016, 4:13am UTC](https://discuss.elastic.co/t/noclassdeffounderror-httpasyncresponseconsumer/64231/1 "2016-10-28T04:13:28Z")

</div>

getting following error  
java.lang.NoClassDefFoundError: org/apache/http/nio/protocol/HttpAsyncResponseConsumer  
for code-  
RestClientImpl impl=new RestClientImpl();  
impl.restClient= RestClient.builder( new HttpHost("localhost", 9200)).build();

imported these two-  
import org.apache.http.HttpHost;  
import org.apache.http.impl.nio.client.HttpAsyncClientBuilder;

using ES v5 rest api jar.

---

<div class="post-metadata">

### Author: ![nik9000](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/nik9000/32/44947_2.png) [@nik9000](https://discuss.elastic.co/u/nik9000)
#### Post date: [October 30, 2016, 3:36am UTC](https://discuss.elastic.co/t/noclassdeffounderror-httpasyncresponseconsumer/64231/2 "2016-10-30T03:36:38Z")

</div>

I believe this is the same problem as

> <https://github.com/elastic/elasticsearch/issues/21170>

You can work around it by adding the http client's dependencies to your POM. In gradle they look like:

```auto
  compile "org.apache.httpcomponents:httpclient:4.5.2"
  compile "org.apache.httpcomponents:httpcore:4.4.5"
  compile "org.apache.httpcomponents:httpasyncclient:4.1.2"
  compile "org.apache.httpcomponents:httpcore-nio:4.4.5"
  compile "commons-codec:commons-codec:1.10"
  compile "commons-logging:commons-logging:1.1.3"

```

I won't try to translate that to maven because I can't test it locally at this point but it should be fairly trivial. I'll update the issue I linked above to make it clear that this is also happening for the http client.

---

<div class="post-metadata">

### Author: ![nik9000](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/nik9000/32/44947_2.png) [@nik9000](https://discuss.elastic.co/u/nik9000)
#### Post date: [October 30, 2016, 3:39am UTC](https://discuss.elastic.co/t/noclassdeffounderror-httpasyncresponseconsumer/64231/3 "2016-10-30T03:39:12Z")

</div>

Actually the [pom](http://repo1.maven.org/maven2/org/elasticsearch/client/rest/5.0.0/rest-5.0.0.pom) looks right to me. How are you attempting to resolve the transitive dependencies?

---

<div class="post-metadata">

### Author: ![Sharat\_Jagannath](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/sharat_jagannath/32/24299_2.png) [@Sharat\_Jagannath](https://discuss.elastic.co/u/Sharat_Jagannath)
#### Post date: [November 7, 2016, 10:48pm UTC](https://discuss.elastic.co/t/noclassdeffounderror-httpasyncresponseconsumer/64231/4 "2016-11-07T22:48:21Z")

</div>

resolved it. There was some issue with my eclipse.

---

<div class="post-metadata">

### Author: ![system](https://us1.discourse-cdn.com/elastic/original/3X/1/a/1ac57faf039f6b580b3f104ef42a2a89e41014de.png) [@system](https://discuss.elastic.co/u/system)
#### Post date: [July 5, 2017, 10:06pm UTC](https://discuss.elastic.co/t/noclassdeffounderror-httpasyncresponseconsumer/64231/5 "2017-07-05T22:06:10Z")

</div>


