1
我是apache spark的新手,試圖玩弄它。我已經解包了spark-1.1.0-bin-hadoop2.3,並且因爲它是一個預製版本,所以我不必再重新構建它。Apache Spark:spark-submit給出了java.lang.IncompatibleClassChangeError異常
接下來我所做的是我安裝了maven,在PATH變量中配置了maven。
然後創建類似this一個獨立的Java應用程序和使用Maven的用下面的命令運行它:
$ mvn package
$ mvn exec:java -Dexec.mainClass="SimpleApp"
它的工作完美,我得到的輸出也。
然後,我嘗試使用火花提交實用程序來運行應用程序,並運行以下命令
$ mvn package
$ YOUR_SPARK_HOME/bin/spark-submit --class "SimpleApp" --master local[4] target/simple-project-1.0.jar
即使第一命令構建它完美,運行第二個命令給了我這個錯誤:
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)
這裏是Java應用程序
<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">
<groupId>edu.berkeley</groupId>
<artifactId>simple-project</artifactId>
<modelVersion>4.0.0</modelVersion>
<name>Simple Project</name>
<packaging>jar</packaging>
<version>1.0</version>
<repositories>
<repository>
<id>Akka repository</id>
<url>http://repo.akka.io/releases</url>
</repository>
</repositories>
<dependencies>
<dependency> <!-- Spark dependency -->
<groupId>org.apache.spark</groupId>
<artifactId>spark-core_2.10</artifactId>
<version>1.1.0</version>
</dependency>
</dependencies>
</project>
的pom.xml中請幫助我找出問題的原因以及如何解決問題。我錯過了這裏的任何一步嗎?
問候, Subhankar