启动Spark REPL时出错

时间:2015-07-23 17:52:12

标签: hadoop apache-spark yarn

我预先构建了Spark 1.4.1,并且我正在运行HDP 2.6。当我尝试运行spark-shell时,它会给出一条错误消息,如下所示。

 Exception in thread "main" java.lang.NoClassDefFoundError: org/apache/hadoop/fs/FSDataInputStream
    at org.apache.spark.deploy.SparkSubmitArguments$$anonfun$mergeDefaultSparkProperties$1.apply(SparkSubmitArguments.scala:111)
    at org.apache.spark.deploy.SparkSubmitArguments$$anonfun$mergeDefaultSparkProperties$1.apply(SparkSubmitArguments.scala:111)
    at scala.Option.getOrElse(Option.scala:120)
    at org.apache.spark.deploy.SparkSubmitArguments.mergeDefaultSparkProperties(SparkSubmitArguments.scala:111)
    at org.apache.spark.deploy.SparkSubmitArguments.<init>(SparkSubmitArguments.scala:97)
    at org.apache.spark.deploy.SparkSubmit$.main(SparkSubmit.scala:107)
    at org.apache.spark.deploy.SparkSubmit.main(SparkSubmit.scala)
Caused by: java.lang.ClassNotFoundException: org.apache.hadoop.fs.FSDataInputStream
    at java.net.URLClassLoader$1.run(URLClassLoader.java:366)
    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 sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:308)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:358)

问题是什么?

2 个答案:

答案 0 :(得分:3)

  当类加载器找不到时,会出现

ClassNotFoundException   类路径中必需的类。所以,基本上你应该检查你的   类路径并在类路径中添加类。

检查hadoop-common-0.21.0.jar是否已添加到类路径中。

答案 1 :(得分:0)

您的Hadoop主页是否可能未设置,如此处所示?

Cannot find hadoop installation: $HADOOP_HOME must be set or hadoop must be in the path