Getting exception : java.lang.NoSuchMethodError: scala.reflect.api.JavaUniverse.runtimeMirror(Ljava/lang/ClassLoader;) while using data frames
<p>I am receiving "java.lang.NoSuchMethodError: scala.reflect.api.JavaUniverse.runtimeMirror(Ljava/lang/ClassLoader;)" error while using dataframes in scala app and running it using spark. However if I work using only RDD's and not dataframes, no such error comes up with same pom and settings. Also while going through other posts with same error, it is mentioned that scala version has to be 2.10 as spark is not compatible with 2.11 scala, and i am using 2.10 scala version with 2.0.0 spark.</p>

<pre><code>Below is the snip from pom:



&lt;properties&gt;
      &lt;spark-assembly&gt;/usr/lib/spark/lib/spark-assembly.jar&lt;/spark-assembly&gt;
      &lt;encoding&gt;UTF-8&lt;/encoding&gt;
      &lt;hadoop.version&gt;2.7.1&lt;/hadoop.version&gt;
      &lt;hbase.version&gt;1.1.1&lt;/hbase.version&gt;
      &lt;scala.version&gt;2.10.5&lt;/scala.version&gt;
      &lt;scala.tools.version&gt;2.10&lt;/scala.tools.version&gt;
      &lt;spark.version&gt;2.0.0&lt;/spark.version&gt;
      &lt;phoenix.version&gt;4.7.0-HBase-1.1&lt;/phoenix.version&gt;
  &lt;/properties&gt;

  &lt;dependencies&gt;
      &lt;dependency&gt;
          &lt;groupId&gt;org.scala-lang&lt;/groupId&gt;
          &lt;artifactId&gt;scala-library&lt;/artifactId&gt;
          &lt;version&gt;${scala.version}&lt;/version&gt;
      &lt;/dependency&gt;
      &lt;dependency&gt;
          &lt;groupId&gt;org.apache.hadoop&lt;/groupId&gt;
          &lt;artifactId&gt;hadoop-client&lt;/artifactId&gt;
          &lt;version&gt;${hadoop.version}&lt;/version&gt;
      &lt;/dependency&gt;
      &lt;dependency&gt;
          &lt;groupId&gt;org.apache.hbase&lt;/groupId&gt;
          &lt;artifactId&gt;hbase-client&lt;/artifactId&gt;
          &lt;version&gt;${hbase.version}&lt;/version&gt;
      &lt;/dependency&gt;
      &lt;dependency&gt;
          &lt;groupId&gt;org.apache.hbase&lt;/groupId&gt;
          &lt;artifactId&gt;hbase-server&lt;/artifactId&gt;
          &lt;version&gt;${hbase.version}&lt;/version&gt;
      &lt;/dependency&gt;
      &lt;dependency&gt;
          &lt;groupId&gt;org.apache.spark&lt;/groupId&gt;
          &lt;artifactId&gt;spark-core_${scala.tools.version}&lt;/artifactId&gt;
          &lt;version&gt;${spark.version}&lt;/version&gt;
      &lt;/dependency&gt;
      &lt;dependency&gt;
          &lt;groupId&gt;org.apache.spark&lt;/groupId&gt;
          &lt;artifactId&gt;spark-sql_${scala.tools.version}&lt;/artifactId&gt;
          &lt;version&gt;${spark.version}&lt;/version&gt;
      &lt;/dependency&gt;
      &lt;dependency&gt;
          &lt;groupId&gt;org.apache.spark&lt;/groupId&gt;
          &lt;artifactId&gt;spark-hive_${scala.tools.version}&lt;/artifactId&gt;
          &lt;version&gt;${spark.version}&lt;/version&gt;
      &lt;/dependency&gt;

  &lt;/dependencies&gt;
</code></pre>

<p>Error:</p>

<pre><code>16/10/19 02:57:26 ERROR yarn.ApplicationMaster: User class threw exception: java.lang.NoSuchMethodError: scala.reflect.api.JavaUniverse.runtimeMirror(Ljava/lang/ClassLoader;)Lscala/reflect/api/JavaMirrors$JavaMirror;
java.lang.NoSuchMethodError: scala.reflect.api.JavaUniverse.runtimeMirror(Ljava/lang/ClassLoader;)Lscala/reflect/api/JavaMirrors$JavaMirror;
        at com.abc.xyz.Compare$.main(Compare.scala:64)
        at com.abc.xyz.Compare.main(Compare.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:498)
        at org.apache.spark.deploy.yarn.ApplicationMaster$$anon$2.run(ApplicationMaster.scala:627)
16/10/19 02:57:26 INFO yarn.ApplicationMaster: Final app status: FAILED, exitCode: 15, (reason: User class threw exception: java.lang.NoSuchMethodError: scala.reflect.api.JavaUniverse.runtimeMirror(Ljava/lang/ClassLoader;)Lscala/reflect/api/JavaMirrors$JavaMirror;)
16/10/19 02:57:26 INFO spark.SparkContext: Invoking stop() from shutdown hook
</code></pre>