title: Apache Spark : spark-submit gives java.lang.IncompatibleClassChangeError exception
body: <p>I am new to apache spark and trying to play around with it. I have unpacked spark-1.1.0-bin-hadoop2.3 and because it is a pre built version, I didn't have to build it again. </p>
  
  <p>So next what I did is I installed maven, configured maven in the PATH variable. </p>
  
  <p>Then I created a standalone java app similar to <a href="http://spark.apache.org/docs/0.9.1/quick-start.html" rel="nofollow">this</a> and and ran it using maven with the following command:</p>
  
  <pre><code>$ mvn package
  $ mvn exec:java -Dexec.mainClass="SimpleApp"
  </code></pre>
  
  <p>It worked perfectly and I got the output also.</p>
  
  <p>Then I was trying to run the app using spark-submit utility and ran the following command</p>
  
  <pre><code>$ mvn package
  $ YOUR_SPARK_HOME/bin/spark-submit --class "SimpleApp" --master local[4] target/simple-project-1.0.jar
  </code></pre>
  
  <p>Even though the first command builds it perfectly, running the second command gives me this error:</p>
  
  <pre><code> Exception in thread "main" java.lang.IncompatibleClassChangeError: class SimpleApp$1 has interface org.apache.spark.api.java.function.Function as super class
      at java.lang.ClassLoader.defineClass1(Native Method)
      at java.lang.ClassLoader.defineClass(ClassLoader.java:800)
      at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:142)
      at java.net.URLClassLoader.defineClass(URLClassLoader.java:449)
      at java.net.URLClassLoader.access$100(URLClassLoader.java:71)
      at java.net.URLClassLoader$1.run(URLClassLoader.java:361)
      at java.net.URLClassLoader$1.run(URLClassLoader.java:355)
      at java.security.AccessController.doPrivileged(Native Method)
      at java.net.URLClassLoader.findClass(URLClassLoader.java:354)
      at java.lang.ClassLoader.loadClass(ClassLoader.java:425)
      at java.lang.ClassLoader.loadClass(ClassLoader.java:358)
      at SimpleApp.main(SimpleApp.java:17)
      at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
      at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
      at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
      at java.lang.reflect.Method.invoke(Method.java:606)
      at org.apache.spark.deploy.SparkSubmit$.launch(SparkSubmit.scala:328)
      at org.apache.spark.deploy.SparkSubmit$.main(SparkSubmit.scala:75)
      at org.apache.spark.deploy.SparkSubmit.main(SparkSubmit.scala)
  </code></pre>
  
  <p>Here is the pom.xml of the Java app</p>
  
  <pre><code>&lt;project  xmlns="http://maven.apache.org/POM/4.0.0" 
   xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 
   xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 
   http://maven.apache.org/xsd/maven-4.0.0.xsd"&gt;
        &lt;groupId&gt;edu.berkeley&lt;/groupId&gt;
        &lt;artifactId&gt;simple-project&lt;/artifactId&gt;
        &lt;modelVersion&gt;4.0.0&lt;/modelVersion&gt;
        &lt;name&gt;Simple Project&lt;/name&gt;
        &lt;packaging&gt;jar&lt;/packaging&gt;
        &lt;version&gt;1.0&lt;/version&gt;
        &lt;repositories&gt;
           &lt;repository&gt;
              &lt;id&gt;Akka repository&lt;/id&gt;
              &lt;url&gt;http://repo.akka.io/releases&lt;/url&gt;
           &lt;/repository&gt;
        &lt;/repositories&gt;
        &lt;dependencies&gt;
            &lt;dependency&gt; &lt;!-- Spark dependency --&gt;
                &lt;groupId&gt;org.apache.spark&lt;/groupId&gt;
                &lt;artifactId&gt;spark-core_2.10&lt;/artifactId&gt;
                &lt;version&gt;1.1.0&lt;/version&gt;
            &lt;/dependency&gt;
         &lt;/dependencies&gt;
    &lt;/project&gt;
  </code></pre>
  
  <p>Kindly help me find the cause of the issue and how to resolve it. Am I missing any step here?</p>
  
  <p>Regards,
  Subhankar</p>