# Unable to push data into ES from Apache Spark

**URL:** <https://discuss.elastic.co/t/unable-to-push-data-into-es-from-apache-spark/40045>\
**Category:** Elasticsearch\
**Created:** [January 25, 2016, 4:37pm UTC](https://discuss.elastic.co/t/unable-to-push-data-into-es-from-apache-spark/40045 "2016-01-25T16:37:07Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![gaurav6351](https://avatars.discourse-cdn.com/v4/letter/g/a3d4f5/32.png) [@gaurav6351](https://discuss.elastic.co/u/gaurav6351)\
**Post date:** [January 25, 2016, 4:37pm UTC](https://discuss.elastic.co/t/unable-to-push-data-into-es-from-apache-spark/40045/1 "2016-01-25T16:37:07Z")

</div>

I have created a jar file using sbt package and using that jar file to run my code .

bin/spark-submit --jars /home/clogeny/analyser/reference-apps/logs\_analyzer/chapter1/scala/target/scala-2.10/spark-logs-analyzer\_2.10-1.0.jar --class "com.databricks.apps.logs.chapter1.LogAnalyzer" /home/clogeny/analyser/reference-apps/logs\_analyzer/data/apache.access.log  
16/01/25 22:06:26 WARN Utils: Your hostname, clogeny-Inspiron-3442 resolves to a loopback address: 127.0.1.1; using 192.168.0.104 instead (on interface wlan0)  
16/01/25 22:06:26 WARN Utils: Set SPARK\_LOCAL\_IP if you need to bind to another address  
Exception in thread "main" java.lang.ArrayIndexOutOfBoundsException: 0  
at com.databricks.apps.logs.chapter1.LogAnalyzer$.main(LogAnalyzer.scala:23)  
at com.databricks.apps.logs.chapter1.LogAnalyzer.main(LogAnalyzer.scala)  
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)  
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)  
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)  
at java.lang.reflect.Method.invoke(Method.java:497)  
at org.apache.spark.deploy.SparkSubmit$.org$apache$spark$deploy$SparkSubmit$$runMain(SparkSubmit.scala:731)  
at org.apache.spark.deploy.SparkSubmit$.doRunMain$1(SparkSubmit.scala:181)  
at org.apache.spark.deploy.SparkSubmit$.submit(SparkSubmit.scala:206)  
at org.apache.spark.deploy.SparkSubmit$.main(SparkSubmit.scala:121)  
at org.apache.spark.deploy.SparkSubmit.main(SparkSubmit.scala)

* * *

And when i dont pass --jars option and fire command as

bin/spark-submit --class "com.databricks.apps.logs.chapter1.LogAnalyzer" /home/clogeny/analyser/reference-apps/logs\_analyzer/chapter1/scala/target/scala-2.10/spark-logs-analyzer\_2.10-1.0.jar/home/clogeny/analyser/reference-apps/logs\_analyzer/data/apache.access.log

it say

Exception in thread "main" java.lang.NoClassDefFoundError: org/elasticsearch/spark/package$  
at com.databricks.apps.logs.chapter1.LogAnalyzer$.main(LogAnalyzer.scala:33)  
at com.databricks.apps.logs.chapter1.LogAnalyzer.main(LogAnalyzer.scala)  
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)  
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)  
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)  
at java.lang.reflect.Method.invoke(Method.java:497)  
at org.apache.spark.deploy.SparkSubmit$.org$apache$spark$deploy$SparkSubmit$$runMain(SparkSubmit.scala:731)  
at org.apache.spark.deploy.SparkSubmit$.doRunMain$1(SparkSubmit.scala:181)  
at org.apache.spark.deploy.SparkSubmit$.submit(SparkSubmit.scala:206)  
at org.apache.spark.deploy.SparkSubmit$.main(SparkSubmit.scala:121)  
at org.apache.spark.deploy.SparkSubmit.main(SparkSubmit.scala)  
Caused by: java.lang.ClassNotFoundException: org.elasticsearch.spark.package$  
at java.net.URLClassLoader.findClass(URLClassLoader.java:381)  
at java.lang.ClassLoader.loadClass(ClassLoader.java:424)  
at java.lang.ClassLoader.loadClass(ClassLoader.java:357)  
... 11 more

---

<div class="post-metadata">

**Author:** ![danielmitterdorfer](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/danielmitterdorfer/32/110510_2.png) [@danielmitterdorfer](https://discuss.elastic.co/u/danielmitterdorfer)\
**Post date:** [January 26, 2016, 12:27pm UTC](https://discuss.elastic.co/t/unable-to-push-data-into-es-from-apache-spark/40045/2 "2016-01-26T12:27:22Z")

</div>

Hi,

this is not related to Elasticsearch but related to your demo program. For the first invocation it says right in the trace:

```auto
Exception in thread "main" java.lang.ArrayIndexOutOfBoundsException: 0
	at com.databricks.apps.logs.chapter1.LogAnalyzer$.main(LogAnalyzer.scala:23)

```

So in your program you access an array, probably command line args, but have not provided any on the command line.

The second invocation is missing necessary classes on the classpath and simply cannot work.

Daniel

---

<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, 11:21pm UTC](https://discuss.elastic.co/t/unable-to-push-data-into-es-from-apache-spark/40045/3 "2017-07-05T23:21:28Z")

</div>


