【问题标题】:java.lang.NoClassDefFoundError: running Mahout example on a hadoop Clusterjava.lang.NoClassDefFoundError:在 hadoop 集群上运行 Mahout 示例
【发布时间】:2016-06-16 14:05:25
【问题描述】:

我正在关注 kmeans clustring 的 Mahout In Action 教程,我使用与 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: 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

谢谢。

【问题讨论】:

  • maven 生产两个罐子吗? clustering-0.0.1-SNAPSHOT.jarclustering-0.0.1-SNAPSHOT-jar-with-dependencies.jar?
  • 它会产生一个名为 mia-0.5.jar 的 jar (本书作者在此提到它stackoverflow.com/a/11482253/5089324
  • 如何构建clustering-0.0.1-SNAPSHOT.jar
  • 在 Eclipse 中,右键单击项目名称和 RunAs Maven Install。我忘记更改 pom.xml 中的 artifactId 和 groupId。我使用的和本书作者使用的一样。

标签: java maven hadoop mahout hortonworks-data-platform


【解决方案1】:

您的集群上的代码似乎有一个不可用的依赖项。

根据您应该使用的项目中的 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 类包含在 mahout-core-0.*.jar 我有 mahout-core-0.7.jar 并且该类存在于其中。

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

【讨论】:

    猜你喜欢
    • 2012-07-09
    • 1970-01-01
    • 2011-08-06
    • 2015-02-13
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2018-01-23
    相关资源
    最近更新 更多