Apache spark 运行mahout spark itemsimilarity时出现NoClassDefFoundError

Apache spark 运行mahout spark itemsimilarity时出现NoClassDefFoundError,apache-spark,mahout,Apache Spark,Mahout,我对mahout是新手,希望根据此页面运行命令“mahout spark itemsimilarity”。然而,我得到以下错误,我谷歌了很多,但仍然没有得到任何相关的 ./bin/mahout spark-itemsimilarity Error: A JNI error has occurred, please check your installation and try again Exception in thread "main" java.lang.NoClassDefFoundEr

我对mahout是新手,希望根据此页面运行命令“mahout spark itemsimilarity”。然而,我得到以下错误,我谷歌了很多,但仍然没有得到任何相关的

./bin/mahout spark-itemsimilarity
Error: A JNI error has occurred, please check your installation and try again
Exception in thread "main" java.lang.NoClassDefFoundError: org/apache/spark/SparkConf
    at java.lang.Class.getDeclaredMethods0(Native Method)
    at java.lang.Class.privateGetDeclaredMethods(Class.java:2701)
    at java.lang.Class.privateGetMethodRecursive(Class.java:3048)
    at java.lang.Class.getMethod0(Class.java:3018)
    at java.lang.Class.getMethod(Class.java:1784)
    at sun.launcher.LauncherHelper.validateMainClass(LauncherHelper.java:544)
    at sun.launcher.LauncherHelper.checkAndLoadMain(LauncherHelper.java:526)
Caused by: java.lang.ClassNotFoundException: org.apache.spark.SparkConf
    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)
    ... 7 more

我正在使用Ubuntu并设置JAVA_HOME、MAHOUT_HOME、SPARK_HOME。我还应该做什么?

在运行命令“mahout spark items”后,我也出现了这个错误

我通过在spark_HOME指向的目录中恢复到spark-1.6.3-bin-hadoop2.4,成功地消除了这个错误


尝试这种方法的想法来自于在Mahout目录中读取README.md的“Building From Source”部分,我以前没有读过,因为我使用了预构建的Mahout二进制文件。

在运行命令“Mahout spark itemsimilarity”后,我也遇到了这个错误

我通过在spark_HOME指向的目录中恢复到spark-1.6.3-bin-hadoop2.4,成功地消除了这个错误


尝试这种方法的想法来自于阅读Mahout目录中README.md的“Building From Source”(从源代码构建)部分,我以前没有读过,因为我使用预构建的Mahout二进制文件。

忘了提到我使用的版本,Mahout 0.12.2,Hadoop 2.7.3您使用的Spark版本是什么?这看起来像是Spark设置问题,因为Spark首先要查找的是SparkConf。您是否能够运行任何Spark演示应用程序或Spark Scala shell?Spark版本为2.1.0。我还没有运行任何spark演示,我会做的。我在mahout文件夹中看到了一些spark jar文件,它还需要spark吗?忘了提到我使用的版本,mahout 0.12.2,Hadoop 2.7.3您使用的spark版本是什么?这看起来像是spark设置问题,因为spark首先要查找的是SparkConf。您是否能够运行任何Spark演示应用程序或Spark Scala shell?Spark版本为2.1.0。我还没有运行任何spark演示,我会做的。我看到一些spark jar文件包含在mahout文件夹中,那还需要spark吗?