# esRDD .count() is not working with my setup

**URL:** <https://discuss.elastic.co/t/esrdd-count-is-not-working-with-my-setup/74126>\
**Category:** Elasticsearch\
**Tags:** es-hadoop\
**Created:** [February 6, 2017, 9:30pm UTC](https://discuss.elastic.co/t/esrdd-count-is-not-working-with-my-setup/74126 "2017-02-06T21:30:01Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![ArtemKoval](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/artemkoval/32/15252_2.png) [@ArtemKoval](https://discuss.elastic.co/u/ArtemKoval)\
**Post date:** [February 6, 2017, 9:30pm UTC](https://discuss.elastic.co/t/esrdd-count-is-not-working-with-my-setup/74126/1 "2017-02-06T21:30:01Z")

</div>

Hi all!

This is the simplest sample I'm trying to get working (code + maven dependencies)

> <https://gist.github.com/ArtemKoval/80169887a487bb5ab89f736eec81e92b>

And it's crushing on .count() call with stack  
java.lang.NoClassDefFoundError: scala/collection/GenTraversableOnce$class  
at org.elasticsearch.spark.rdd.AbstractEsRDDIterator.(AbstractEsRDDIterator.scala:28)  
at org.elasticsearch.spark.rdd.ScalaEsRDDIterator.(ScalaEsRDD.scala:43)  
at org.elasticsearch.spark.rdd.ScalaEsRDD.compute(ScalaEsRDD.scala:39)  
at org.elasticsearch.spark.rdd.ScalaEsRDD.compute(ScalaEsRDD.scala:33)  
at org.apache.spark.rdd.RDD.computeOrReadCheckpoint(RDD.scala:319)  
at org.apache.spark.rdd.RDD.iterator(RDD.scala:283)  
at org.apache.spark.scheduler.ResultTask.runTask(ResultTask.scala:70)  
at org.apache.spark.scheduler.Task.run(Task.scala:86)  
at org.apache.spark.executor.Executor$TaskRunner.run(Executor.scala:274)  
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)  
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)  
at java.lang.Thread.run(Thread.java:745)

It seems to be an incompatibility issue but I can't understand where is it.

Please assist me.

Thanks, Art.

---

<div class="post-metadata">

**Author:** ![james.baiera](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/james.baiera/32/10209_2.png) [@james.baiera](https://discuss.elastic.co/u/james.baiera)\
**Post date:** [February 8, 2017, 3:58pm UTC](https://discuss.elastic.co/t/esrdd-count-is-not-working-with-my-setup/74126/2 "2017-02-08T15:58:36Z")

</div>

This error typically occurs when using a library with an incompatible version of Scala. I'm assuming your Scala version is 2.11 since that's the spark compatibility level you have in your dependencies. I would change your es dependency to `org.elasticsearch:elasticsearch-spark-20:5.2.0`. If you deploy third party jars to your cluster, make sure all nodes have this updated artifact.

---

<div class="post-metadata">

**Author:** ![ArtemKoval](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/artemkoval/32/15252_2.png) [@ArtemKoval](https://discuss.elastic.co/u/ArtemKoval)\
**Post date:** [February 13, 2017, 8:12pm UTC](https://discuss.elastic.co/t/esrdd-count-is-not-working-with-my-setup/74126/3 "2017-02-13T20:12:03Z")

</div>

Hey @james.baiera,

Thanks for your help. Actually I figured out this the hard way 🙂

For future references this is the correct dependency to include into maven's pom

```
 <dependency>
        <groupId>org.elasticsearch</groupId>
        <artifactId>elasticsearch-spark-20_2.11</artifactId>
        <version>5.1.1</version>
    </dependency>

```

Best, Artem.

---

<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:** [March 13, 2017, 8:12pm UTC](https://discuss.elastic.co/t/esrdd-count-is-not-working-with-my-setup/74126/4 "2017-03-13T20:12:41Z")

</div>

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.
