Hadoop安装中的NoClassDefFoundError

时间:2012-06-18 04:35:17

标签: hadoop

我正在使用本指南设置Hadoop:

http://blog.sqltrainer.com/2012/01/installing-and-configuring-apache.html

然而,当我到达我应该键入bin/hadoop version的部分时,我会收到以下错误:

cygpath: can't convert empty path
java.lang.NoClassDefFoundError: org/apache/hadoop/util/PlatformName
Caused by: java.lang.ClassNotFoundException: org.apache.hadoop.util.PlatformName
        at java.net.URLClassLoader$1.run(Unknown Source)
        at java.security.AccessController.doPrivileged(Native Method)
        at java.net.URLClassLoader.findClass(Unknown Source)
        at java.lang.ClassLoader.loadClass(Unknown Source)
        at sun.misc.Launcher$AppClassLoader.loadClass(Unknown Source)
        at java.lang.ClassLoader.loadClass(Unknown Source)
Could not find the main class: org.apache.hadoop.util.PlatformName.  Program will exit.
Exception in thread "main" cygpath: can't convert empty path
cygpath: can't convert empty path
Hadoop 0.22.0

我最近使用的是版本1.0.3并且我工作正常,但由于存在错误,我不得不降级到版本0.22.0。不幸的是我无法使用这个版本。

更多信息:

JAVA_HOME=/cygdrive/c/Progra~1/Java/jre6

2 个答案:

答案 0 :(得分:2)

我在windows / cygwin上安装时遇到了这个错误 在您选择的编辑器中打开$ HADOOP_INSTALL / bin / hadoop-config.sh。 找到以“#cygwin path translation”开头的部分,并添加以下行:

    CLASSPATH=`cygpath -wp "$CLASSPATH"`

保存并退出。

该修复程序对我有用。有关此博客的更多信息

http://juliensimon.blogspot.in/2011/01/installing-hadoop-on-windows-cygwin.html

答案 1 :(得分:1)

构建您的pastebin,看起来您的LD_LIBRARY_PATH变量有问题:

++ JAVA_LIBRARY_PATH=
++ '[' -d 'C:\cygwin\usr\local\hadoop\/build/native' -o -d 'C:\cygwin\usr\local\                      hadoop\/lib/native' ']'
cygwin warning:
 MS-DOS style path detected: C:\cygwin\usr\local\hadoop\/build/native
 Preferred POSIX equivalent is: /usr/local/hadoop/build/native
 CYGWIN environment variable option "nodosfilewarning" turns off this warning.
 Consult the user's guide for more details about POSIX paths:
   http://cygwin.com/cygwin-ug-net/using.html#using-pathnames

这条路径应该是一个cygwin路径(/cygdrive/c/cygwin/usr/local/hadoop/build/native),并确保斜杠是正确的。

为您的bin和conf文件夹中的字符串LD_LIBRARYnative执行grep,以查看您可能将此设置错误的位置