Hadoop HDFS测试运行问题 - org.apache.hadoop.conf.Configuration NoClassDefFoundError

时间:2011-11-28 00:10:52

标签: linux gcc hadoop hdfs

我正在使用Hadoop 0.21.0。并尝试运行与C API库一起提供的hdfs_test应用程序。经过许多问题我能够编译hdfs_test。现在,当我运行它时:

./hdfs_test

我收到以下错误:

Exception in thread "main" java.lang.NoClassDefFoundError: org/apache/commons/logging/LogFactory
at org.apache.hadoop.conf.Configuration.<clinit>(Configuration.java:153)
Caused by: java.lang.ClassNotFoundException: org.apache.commons.logging.LogFactory
at java.net.URLClassLoader$1.run(URLClassLoader.java:217)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.java:205)
at java.lang.ClassLoader.loadClass(ClassLoader.java:321)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:294)
at java.lang.ClassLoader.loadClass(ClassLoader.java:266)
... 1 more
Can't construct instance of class org.apache.hadoop.conf.Configuration
Oops! Failed to connect to hdfs!

感谢任何帮助..谢谢

1 个答案:

答案 0 :(得分:1)

与任何其他Java程序一样,您需要类路径或jar内部的依赖项。 Hadoop还有一个HADOOP_CLASSPATH来告诉集群在map-reduce任务中找到依赖项的位置。另请参阅How to run a Hadoop program?