线程“main”java.lang.CompatibleClassChangeError中出现异常:找到接口org.apache.hadoop.mapreduce.jobcontext,但应为类

vof42yt1  于 2021-06-04  发布在  Hadoop
关注(0)|答案(1)|浏览(378)

我正在尝试运行中提供的示例 Mahout in Action 供推荐。我运行的命令是

hadoop jar mahout-core-0.9-job.jar org.apache.mahout.cf.taste.hadoop.item.RecommenderJob -Dmapred.input.dir=gru/links-simple-sorted.txt -Dmapred.output.dir=output --usersFile gru/users.txt --booleanData -s SIMILARITY_COOCCURRENCE

我得到的错误是

15/01/31 21:05:23 INFO common.AbstractJob: Command line arguments: {--booleanData=[false], --endPhase=[2147483647], --maxPrefsInItemSimilarity=[500], --maxPrefsPerUser=[10], --maxSimilaritiesPerItem=[100], --minPrefsPerUser=[1], --numRecommendations=[10], --similarityClassname=[SIMILARITY_COOCCURRENCE], --startPhase=[0], --tempDir=[temp], --usersFile=[gru/users.txt]}
15/01/31 21:05:23 INFO common.AbstractJob: Command line arguments: {--booleanData=[false], --endPhase=[2147483647], --input=[gru/links-simple-sorted.txt], --minPrefsPerUser=[1], --output=[temp/preparePreferenceMatrix], --ratingShift=[0.0], --startPhase=[0], --tempDir=[temp]}
15/01/31 21:05:23 INFO Configuration.deprecation: mapred.input.dir is deprecated. Instead, use mapreduce.input.fileinputformat.inputdir
15/01/31 21:05:23 INFO Configuration.deprecation: mapred.compress.map.output is deprecated. Instead, use mapreduce.map.output.compress
15/01/31 21:05:23 INFO Configuration.deprecation: mapred.output.dir is deprecated. Instead, use mapreduce.output.fileoutputformat.outputdir
Exception in thread "main" java.lang.IncompatibleClassChangeError: Found interface org.apache.hadoop.mapreduce.JobContext, but class was expected
    at org.apache.mahout.common.HadoopUtil.getCustomJobName(HadoopUtil.java:174)
    at org.apache.mahout.common.AbstractJob.prepareJob(AbstractJob.java:614)
    at org.apache.mahout.cf.taste.hadoop.preparation.PreparePreferenceMatrixJob.run(PreparePreferenceMatrixJob.java:73)
    at org.apache.hadoop.util.ToolRunner.run(ToolRunner.java:70)
    at org.apache.mahout.cf.taste.hadoop.item.RecommenderJob.run(RecommenderJob.java:164)
    at org.apache.hadoop.util.ToolRunner.run(ToolRunner.java:70)
    at org.apache.mahout.cf.taste.hadoop.item.RecommenderJob.main(RecommenderJob.java:322)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:606)
    at org.apache.hadoop.util.RunJar.main(RunJar.java:212)

我读到了这个错误,我理解的是 Hadoop 以及 classes I run 是不兼容的,所以我使用了以下版本的 Mahout ```
$ ls -ltr mahout*
-rw------- 1 me guest 11359832 Jan 31 20:51 mahout-core-0.7-job.jar
-rw------- 1 me guest 8374290 Jan 31 20:56 mahout-core-0.5-job.jar
-rw------- 1 me guest 12831506 Jan 31 21:05 mahout-core-0.9-job.jar

但错误仍然是一样的。
我的 `Hadoop` 版本为

]$ hadoop version
Hadoop 2.5.0-cdh5.2.0
Subversion http://github.com/cloudera/hadoop -r e1f20a08bde76a33b79df026d00a0c91b2298387
Compiled by jenkins on 2014-10-11T21:00Z
Compiled with protoc 2.5.0
From source with checksum 309bccd135b199bdfdd6df5f3f4153d
This command was run using /DCNFS/applications/cdh/5.2/app/hadoop-2.5.0-cdh5.2.0/share/hadoop/common/hadoop-common-2.5.0-cdh5.2.0.jar

我错过了什么?如何解决这个问题?
m4pnthwp

m4pnthwp1#

我只需要一个不同的mahout发行版,cloudera发行版
在我使用了下面的jar文件之后,错误就消失了

mahout-core-0.9-cdh5.2.0-job.jar

相关问题