0

我对hadoop和map reduce编程很陌生。我下载了 1.2.1 版,并试图用命令查看一些示例

bin/hadoop jar hadoop*example*.jar

使用此命令,我遇到了异常。这里有什么问题?安装有问题吗?

Exception in thread "main" java.lang.NoClassDefFoundError: 1/2/1/hadoop-1/2/1/libexec////logs
Caused by: java.lang.ClassNotFoundException: 1.2.1.hadoop-1.2.1.libexec....logs
    at java.net.URLClassLoader$1.run(URLClassLoader.java:200)
    at java.security.AccessController.doPrivileged(Native Method)
    at java.net.URLClassLoader.findClass(URLClassLoader.java:188)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:315)
    at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:330)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:250)
    at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:398)
4

1 回答 1

1

正确的命令是:

bin/hadoop jar hadoop-*-examples.jar <program name>

如果您使用的是自定义 map reduce 类,请在 main 方法上尝试以下配置:

job.setJarByClass(WordCount.class);

参考: http: //mydailylearningblog.blogspot.com.br/2011/06/javalangclassnotfoundexception.html

于 2013-11-05T15:22:17.050 回答