This question already has answers here:
Resolving dependency problems in Apache Spark
(7个答案)
3年前关闭。
安装spark 2.0.0后运行spark2-submit时出现以下错误。
有谁知道为什么它不能指向hadoop jar文件?当我在spark2-submit中'
(7个答案)
3年前关闭。
安装spark 2.0.0后运行spark2-submit时出现以下错误。
有谁知道为什么它不能指向hadoop jar文件?当我在spark2-submit中'
echo $HADOOP_HOME
'时,它显示正确的HADOOP_HOME
路径。Exception in thread "main" java.lang.NoClassDefFoundError: org/apache/hadoop/fs/FSDataInputStream
at org.apache.spark.deploy.SparkSubmitArguments$$anonfun$mergeDefaultSparkProperties$1.apply(SparkSubmitArguments.scala:118)
at org.apache.spark.deploy.SparkSubmitArguments$$anonfun$mergeDefaultSparkProperties$1.apply(SparkSubmitArguments.scala:118)
at scala.Option.getOrElse(Option.scala:121)
at org.apache.spark.deploy.SparkSubmitArguments.mergeDefaultSparkProperties(SparkSubmitArguments.scala:118)
at org.apache.spark.deploy.SparkSubmitArguments.<init>(SparkSubmitArguments.scala:104)
at org.apache.spark.deploy.SparkSubmit$.main(SparkSubmit.scala:117)
at org.apache.spark.deploy.SparkSubmit.main(SparkSubmit.scala)
Caused by: java.lang.ClassNotFoundException: org.apache.hadoop.fs.FSDataInputStream
at java.net.URLClassLoader.findClass(URLClassLoader.java:381)
at java.lang.ClassLoader.loadClass(ClassLoader.java:424)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:331)
at java.lang.ClassLoader.loadClass(ClassLoader.java:357)
最佳答案
尝试将HADOOP_HOME / share / hadoop中的jar添加到CLASSPATH。
例如我在/ etc / profile中添加了CLASSPATH,而我的hadoop版本是2.7.2。
export CLASSPATH=.:$JAVA_HOME/lib:$JRE_HOME/lib:$HADOOP_HOME/share/hadoop/mapreduce/hadoop-mapreduce-client-core-2.7.2.jar:$HADOOP_HOME/share/hadoop/common/hadoop-common-2.7.2.jar:$HADOOP_HOME/share/hadoop/common/lib/commons-cli-1.2.jar:$CLASSPATH
09-07 15:53