# Cannot load class org.elasticsearch.spark.sql.SparkSQLCompatibilityLevel

**URL:** <https://discuss.elastic.co/t/cannot-load-class-org-elasticsearch-spark-sql-sparksqlcompatibilitylevel/152517>\
**Category:** Elasticsearch\
**Tags:** es-hadoop\
**Created:** [October 15, 2018, 2:44pm UTC](https://discuss.elastic.co/t/cannot-load-class-org-elasticsearch-spark-sql-sparksqlcompatibilitylevel/152517 "2018-10-15T14:44:25Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![SKing](https://avatars.discourse-cdn.com/v4/letter/s/8c91f0/32.png) [@SKing](https://discuss.elastic.co/u/SKing)\
**Post date:** [October 15, 2018, 2:44pm UTC](https://discuss.elastic.co/t/cannot-load-class-org-elasticsearch-spark-sql-sparksqlcompatibilitylevel/152517/1 "2018-10-15T14:44:25Z")

</div>

I am running a Java Spark application. I can run the application from inside the intellij IDE. However, if I try to run it using the application built as a jar I get the following error.

Caused by: org.elasticsearch.hadoop.EsHadoopIllegalStateException: Cannot load class [org.elasticsearch.spark.sql.SparkSQLCompatibilityLevel]

Using  
spark-core\_2.10 v 1.6.3  
elasticsearch-spark-13\_2.10 v 5.6.8

The problem seems identical to the one encountered in this thread.

> [@Class org.elasticsearch.spark.sql.SparkSQLCompatibilityLevel not found](https://discuss.elastic.co/t/class-org-elasticsearch-spark-sql-sparksqlcompatibilitylevel-not-found/76857):
>
> Playing with es4Hadoop 5.2.1 and Spark, I built a Java application with Maven deps: \<dependencies\> \<dependency\> \<groupId\>org.apache.spark\</groupId\> \<artifactId\>spark-core\_2.10\</artifactId\> \<version\>1.6.2\</version\> \</dependency\> \<!-- https://mvnrepository.com/artifact/org.apache.spark/spark-sql\_2.10 --\> \<dependency\> \<groupId\>org.apache.spark\</groupId\> \<artifactId\>spark-sql\_2.10\</artifactId\> \<version\>1.6.2\</version\> \</dependency\>…

However, no mention is given of how to fix this.

---

<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:** [October 23, 2018, 3:10pm UTC](https://discuss.elastic.co/t/cannot-load-class-org-elasticsearch-spark-sql-sparksqlcompatibilitylevel/152517/2 "2018-10-23T15:10:34Z")

</div>

Since the job succeeds when launched from the IDE but not when built as a jar, I would double check that the ES-Spark jars are indeed available on the classpath for your spark program.

---

<div class="post-metadata">

**Author:** ![ebuildy](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/ebuildy/32/6070_2.png) [@ebuildy](https://discuss.elastic.co/u/ebuildy)\
**Post date:** [October 24, 2018, 8:26am UTC](https://discuss.elastic.co/t/cannot-load-class-org-elasticsearch-spark-sql-sparksqlcompatibilitylevel/152517/3 "2018-10-24T08:26:39Z")

</div>

Hello,

The cause is the class is loaded dynamically, so this can bug if you optimize the jar (or minimize it via Maven share plugin for instance).

---

<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:** [November 21, 2018, 8:26am UTC](https://discuss.elastic.co/t/cannot-load-class-org-elasticsearch-spark-sql-sparksqlcompatibilitylevel/152517/4 "2018-11-21T08:26:42Z")

</div>

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