Warning: file_get_contents(/data/phpspider/zhask/data//catemap/4/maven/6.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Java NoClassDefFoundError:在hadoop集群上运行Mahout示例_Java_Maven_Hadoop_Mahout_Hortonworks Data Platform - Fatal编程技术网

Java NoClassDefFoundError:在hadoop集群上运行Mahout示例

Java NoClassDefFoundError:在hadoop集群上运行Mahout示例,java,maven,hadoop,mahout,hortonworks-data-platform,Java,Maven,Hadoop,Mahout,Hortonworks Data Platform,我遵循kmeans clustring的Mahout In Action教程,使用的代码与找到的代码相同: 也使用相同的pom.xml。 在我使用eclipse的本地机器上,一切正常,因此我构建jar文件(clustering-0.0.1-SNAPSHOT.jar),并在尝试使用以下工具运行它时将其带到集群(Hortonworks 2.3):hadoop-jar-clustering-0.0.1-SNAPSHOT.jar-com.digimarket.clustering.App(我对我的项目进

我遵循kmeans clustring的Mahout In Action教程,使用的代码与找到的代码相同: 也使用相同的pom.xml。 在我使用eclipse的本地机器上,一切正常,因此我构建jar文件(clustering-0.0.1-SNAPSHOT.jar),并在尝试使用以下工具运行它时将其带到集群(Hortonworks 2.3):
hadoop-jar-clustering-0.0.1-SNAPSHOT.jar-com.digimarket.clustering.App
(我对我的项目进行了不同的命名)我收到了以下错误:

java.lang.NoClassDefFoundError: org/apache/mahout/common/distance/DistanceMeasure

我知道这是一个依赖性问题,我发现以前有过这个问题但不明白他们是如何解决的用户提出的问题。 及

这是我集群中mahout目录的内容:

ls /usr/hdp/2.3.4.0-3485/mahout/
bin
conf
doc
lib
mahout-examples-0.9.0.2.3.4.0-3485.jar
mahout-examples-0.9.0.2.3.4.0-3485-job.jar
mahout-integration-0.9.0.2.3.4.0-3485.jar
mahout-math-0.9.0.2.3.4.0-3485.jar
mahout-mrlegacy-0.9.0.2.3.4.0-3485.jar
mahout-mrlegacy-0.9.0.2.3.4.0-3485-job.jar

谢谢。

看起来您的集群上的代码没有依赖项

根据该项目中的pom.xml,您应该使用:

<properties>
  <mahout.version>0.5</mahout.version>
  <mahout.groupid>org.apache.mahout</mahout.groupid>
</properties>
...
<dependencies>
  <dependency>
    <groupId>${mahout.groupid}</groupId>
    <artifactId>mahout-core</artifactId>
    <version>${mahout.version}</version>
  </dependency>
  ...
</dependencies>

0.5
org.apache.mahout
...
${mahout.groupid}


您可以下载该jar并将其包含在-libjars标志中,也可以将其放在hadoop类路径上。

maven是否生成两个jar
clustering-0.0.1-SNAPSHOT.jar
clustering-0.0.1-SNAPSHOT-jar-with-dependencies.jar
?它生成一个名为mia-0.5.jar的jar(这本书的作者在这里提到过它)如何构建
clustering-0.0.1-SNAPSHOT.jar
?在Eclipse中,右键单击项目名称并运行为Maven安装。我忘了更改pom.xml中的artifactId和groupId。我用的和这本书的作者用的一样。