HADOOP :: java.lang.ClassNotFoundException: WordCount
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/14554088/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
HADOOP :: java.lang.ClassNotFoundException: WordCount
提问by Ronin
I am using eclipse to export the jar file of a map-reduce program. When i am run the jar using command
我正在使用 eclipse 导出 map-reduce 程序的 jar 文件。当我使用命令运行 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.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.
我无法弄清楚问题出在哪里。
回答by Charles Menguy
If you're trying to run the wordcount provided in the examples, you should run:
如果您尝试运行示例中提供的 wordcount,您应该运行:
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