# Exception while using elastic-hadoop library for Apache Spark from spark-shell

**URL:** <https://discuss.elastic.co/t/exception-while-using-elastic-hadoop-library-for-apache-spark-from-spark-shell/90406>\
**Category:** Elasticsearch\
**Tags:** es-hadoop\
**Created:** [June 22, 2017, 7:54am UTC](https://discuss.elastic.co/t/exception-while-using-elastic-hadoop-library-for-apache-spark-from-spark-shell/90406 "2017-06-22T07:54:48Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![Vittorio](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/vittorio/32/18171_2.png) [@Vittorio](https://discuss.elastic.co/u/Vittorio)\
**Post date:** [June 22, 2017, 7:54am UTC](https://discuss.elastic.co/t/exception-while-using-elastic-hadoop-library-for-apache-spark-from-spark-shell/90406/1 "2017-06-22T07:54:48Z")

</div>

Hi all,

I'm new to the world of apache spark/hadoop and I'm trying the simple examples i found on the elasticsearch/spark web page to simply read/write data to elasticsearch from the spark-shell.

I've tried to write data, and it worked just fine! When I read it works but then when i try to show the content of the RDD doing RDD.collect() it throws and exception:

```
scala> RDD.collect()
17/06/21 14:26:50 ERROR Executor: Exception in task 0.0 in stage 3.0 (TID 13)
java.lang.NoClassDefFoundError: scala/collection/GenTraversableOnce$class
	at org.elasticsearch.spark.rdd.AbstractEsRDDIterator.<init>(AbstractEsRDDIterator.scala:28)
	at org.elasticsearch.spark.rdd.ScalaEsRDDIterator.<init>(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:323)
	at org.apache.spark.rdd.RDD.iterator(RDD.scala:287)
	at org.apache.spark.scheduler.ResultTask.runTask(ResultTask.scala:87)
	at org.apache.spark.scheduler.Task.run(Task.scala:99)
	at org.apache.spark.executor.Executor$TaskRunner.run(Executor.scala:322)
	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:748)

```

I'm using Scala version 2.11.8, spark version 2.1.1 and elasticsearch-hadoop-5.4.1.jar.  
thanks

---

<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:** [June 22, 2017, 7:22pm UTC](https://discuss.elastic.co/t/exception-while-using-elastic-hadoop-library-for-apache-spark-from-spark-shell/90406/2 "2017-06-22T19:22:06Z")

</div>

This often occurs when using the incorrect Scala versions of Spark or elasticsearch-hadoop. Try using the [2.11 compatibility jar](https://mvnrepository.com/artifact/org.elasticsearch/elasticsearch-spark-20_2.11/5.4.1) for Spark.

---

<div class="post-metadata">

**Author:** ![Vittorio](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/vittorio/32/18171_2.png) [@Vittorio](https://discuss.elastic.co/u/Vittorio)\
**Post date:** [June 23, 2017, 7:59am UTC](https://discuss.elastic.co/t/exception-while-using-elastic-hadoop-library-for-apache-spark-from-spark-shell/90406/3 "2017-06-23T07:59:09Z")

</div>

Thnks @james.baiera , it's frustating to find the correct jar that is not deprecated even if it was released on May...

---

<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 21, 2017, 7:59am UTC](https://discuss.elastic.co/t/exception-while-using-elastic-hadoop-library-for-apache-spark-from-spark-shell/90406/4 "2017-07-21T07:59:11Z")

</div>

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