2016-03-03 201 views
0

Mahout的例子中,我跟随亨利马乌在行动教程k均值clustring,我使用相同的代码中发现here: 具有相同的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:上运行Hadoop集群

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

我知道这是一个依赖的问题,我发现谁收到了这个问题,但不知道他们怎么解决的,用户提出的问题。 herehere

这是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 

感谢。

+0

maven是否会生产两个罐子; 'clustering-0.0.1-SNAPSHOT.jar'和'clustering-0.0.1-SNAPSHOT-jar-with-dependencies.jar'? – rj93

+0

它生成一个名为mia-0.5.jar的jar(本书的作者http://stackoverflow.com/a/11482253/5089324) – zaher

+0

如何构建'clustering-0.0.1-SNAPSHOT.jar '? – rj93

回答

0

它看起来像您有一个依赖项,您的群集上的代码不可用。

基于从该项目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> 

类org.apache.mahout.common.distance.DistanceMeasure包括在象夫核-0 *。 jar我有mahout-core-0.7.jar,并且类存在于那里。

enter image description here

您可以下载JAR,包括其与-libjars标志或者你可以把它放在Hadoop的类路径。

相关问题