在运行JAVA程序时出错,大家帮看一下是怎么回事,最好懂hadoop编程~~

错误提示如下:
Exception in thread "main" java.lang.NoClassDefFoundError: org/apache/commons/logging/LogFactory
SUCCESS
at org.apache.hadoop.conf.Configuration.<clinit>(Configuration.java:142)
at FileCopyToHdfs.appendToHdfs(FileCopyToHdfs.java:72)
at FileCopyToHdfs.main(FileCopyToHdfs.java:27)
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)
... 3 more
代码是从一个博客上复制下来的,有人回复说下面的这段代码可能有问题,大家帮看一下

/**遍历HDFS上的文件和目录*/
private static void getDirectoryFromHdfs() throws FileNotFoundException,IOException {
String dst = "hdfs://192.168.0.208:9000/user/lingyun";
Configuration conf = new Configuration();
FileSystem fs = FileSystem.get(URI.create(dst), conf);
FileStatus fileList[] = fs.listStatus(new Path(dst));
int size = fileList.length;
for(int i = 0; i < size; i++){
System.out.println("name:" + fileList[i].getPath().getName() + "/t/tsize:" + fileList[i].getLen());
}
fs.close();
}
}
找不到唤租类 :org.apache.commons.logging.LogFactory
没有把jar 包州链穗 添加到lib 里面册卜吧
main函数中发生未找到类定义的错误 是不是需要用到的包没有正确导入?看下是不是导入路径有问题
ClassNotFoundException: 没有加载到对象。