在hadoop1.2.1上创建运行mapreduce的jar

9nvpjoqh  于 2021-05-30  发布在  Hadoop
关注(0)|答案(1)|浏览(328)

我是hadoop新手,我刚刚在mac笔记本电脑(mavericks)上安装了Hadoop1.2.1。然后我在intellijidea中创建了一个简单的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

有人能告诉我我错过了什么吗?

juud5qan

juud5qan1#

我猜您必须指定类(实现map/reduce函数)。例如。, $ java -jar ./WordCount.jar classWordCount input.txt output 或者 $ hadoop jar yourprogram.jar**yourclass**inputpath outputpath

相关问题