本文主要是介绍运行mapreduce实例wordcount时, 出现ClassNotFoundException: org.myorg.WordCount错误解决方法,希望对大家解决编程问题提供一定的参考价值,需要的开发者们随着小编来一起学习吧!
这个错误,网上各有说法,官方的FAQ说的是编译时候要严格按照
$ jar -cvf /usr/joe/wordcount.jar -C wordcount_classes/ .
缺少-C 和 . 号会导致。
但在我机器上,并不存在这一问题,运行
hadoop jar /usr/local/hadoop/wordcount.jar org.myorg.WordCount /test/input /test/output
依然报错。
解决方法如下,首先解压一下你的wordcount.jar ,如我这里是:
[root@master hadoop]# unzip -t wordcount.jar
Archive: wordcount.jar
testing: META-INF/ OK
testing: META-INF/MANIFEST.MF OK
testing: org/ OK
testing: org/apache/ OK
testing: org/apache/hadoop/ OK
testing: org/apache/hadoop/mapred/ OK
testing: org/apache/hadoop/mapred/WordCount.class OK
testing: org/apache/hadoop/mapred/WordCount$MapClass.class OK
testing: org/apache/hadoop/mapred/WordCount$Reduce.class OK
No errors detected in compressed data of wordcount.jar.
因此org.myorg.WordCount应替换成org.apache.hadoop.mapred.WordCount,如:
hadoop jar /usr/local/hadoop/wordcount.jar org.apache.hadoop.mapred.WordCount /test/input /test/output
就可以成功执行MR
这篇关于运行mapreduce实例wordcount时, 出现ClassNotFoundException: org.myorg.WordCount错误解决方法的文章就介绍到这儿,希望我们推荐的文章对编程师们有所帮助!