我是Hadoop的新手,刚刚在我的Mac笔记本电脑(Mavericks)上安装了Hadoop1.2.1。然后,我在IntelliJ IDEA中创建了一个简单的WordCount项目,并能够在伪文本文件上运行代码。我在成功创建一个jar文件时遇到了问题,该文件将通过IDE复制我的执行。我得到以下错误:
java -jar ./out/artifacts/WordCount_jar/WordCount.jar test.txt out [19:35:21]
Exception in thread "main" java.lang.NoClassDefFoundError: org/apache/commons/logging/LogFactory
at org.apache.hadoop.conf.Configuration.<clinit>(Configuration.java:146)
at neu.cs.parallelprogramming.WordCount.main(WordCount.java:48)
Caused by: java.lang.ClassNotFoundException: org.apache.commons.logging.LogFactory
at java.net.URLClassLoader$1.run(URLClassLoader.java:372)
at java.net.URLClassLoader$1.run(URLClassLoader.java:361)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.java:360)
at java.lang.ClassLoader.loadClass(ClassLoader.java:424)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:308)
at java.lang.ClassLoader.loadClass(ClassLoader.java:357)
... 2 more
FAIL: 1
有人能告诉我我缺了什么吗?
我想您必须指定您的类(实现Map/Reduce函数)。例如,$ java -jar ./WordCount.jar classWordCount input.txt output
或$ hadoop jar yourprogram.jar **yourclass** inputpath outputpath