2

我正在尝试按照 Hadoop In Action 中的说明以伪分布式模式运行它。它在我使用本地/独立模式时运行。

现在它似乎无法找到 jar 文件的路径。

cd $HADOOP_HOME


jps
17559 JobTracker
17466 SecondaryNameNode
17791 TaskTracker
16993 NameNode
17942 Jps

bin/hadoop hadoop-examples-1.0.3.jar wordcount

Warning: $HADOOP_HOME is deprecated.

Exception in thread "main" java.lang.NoClassDefFoundError: hadoop-examples-1/0/3/jar
Caused by: java.lang.ClassNotFoundException: hadoop-examples-1.0.3.jar
    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 sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:301)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:247)
Could not find the main class: hadoop-examples-1.0.3.jar.  Program will exit.

我的 CLASSPATH 设置为 $HADOOP_HOME

有任何想法吗?

4

1 回答 1

2

Two things that don't look right:

  1. You should also have DataNode process running check the logs to see what happened to it.

  2. The correct command to use is bin/hadoop jar hadoop-examples-1.0.3.jar wordcount

  3. You should also have HADOOP_CONF_DIR set to point to the directory with 'hdfs-site.xml' and 'core-site.xml'

于 2012-07-24T20:26:24.950 回答