简体   繁体   English

HADOOP :: java.lang.ClassNotFoundException:WordCount

[英]HADOOP :: java.lang.ClassNotFoundException: WordCount

I am using eclipse to export the jar file of a map-reduce program. 我正在使用eclipse导出map-reduce程序的jar文件。 When i am run the jar using command 当我使用命令运行jar

 hadoop jar hadoop-prog.jar WordCount /home/temp/input /home/temp/output

it always shows the error : 它总是显示错误:

   Exception in thread "main" java.lang.ClassNotFoundException: WordCount
    at java.net.URLClassLoader$1.run(URLClassLoader.java:202)
    at java.security.AccessController.doPrivileged(Native Method)
    at java.net.URLClassLoader.findClass(URLClassLoader.java:190)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:306)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:247)
    at java.lang.Class.forName0(Native Method)
    at java.lang.Class.forName(Class.java:247)
    at org.apache.hadoop.util.RunJar.main(RunJar.java:149)

Btw, I get a sample example jar file of wordcount from internet and it ran very well. 顺便说一句,我从互联网上得到了wordcount的示例jar文件示例,它运行得很好。

I could not figure out where is the problem. 我不知道问题出在哪里。

If you're trying to run the wordcount provided in the examples, you should run: 如果您尝试运行示例中提供的单词计数,则应运行:

hadoop jar hadoop*examples*.jar wordcount /home/temp/input /home/temp/output

More info on how to run wordcount on this link . 有关如何在此链接上运行wordcount的更多信息。

In general, if you're developing your own Map/Reduce jobs, you should include the full package name of your driver class, so something like this might work: 通常,如果您要开发自己的Map / Reduce作业,则应包括驱动程序类的完整程序包名称,因此这样的操作可能会起作用:

hadoop jar wordcount.jar com.something.WordCount /home/temp/input /home/temp/output

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM