环境: windows 2008 64的位的ecliplse 运行hadoop wordcount
1.已经配置了log4j.properties
2.运行又 出错了
Exception in thread "main" java.lang.UnsatisfiedLinkError: org.apache.hadoop.io.nativeio.NativeIO$Windows.access0(Ljava/lang/String;I)Z
at org.apache.hadoop.io.nativeio.NativeIO$Windows.access0(Native Method)
at org.apache.hadoop.io.nativeio.NativeIO$Windows.access(NativeIO.java:557)
at org.apache.hadoop.fs.FileUtil.canRead(FileUtil.java:977)
at org.apache.hadoop.util.DiskChecker.checkAccessByFileMethods(DiskChecker.java:187)
3.检查:已经配置了winutiles, hadoop.dll
4.百度,要修改hadhoop的源代码(http://www.itnose.net/detail/6177732.html)
在出现错误的的atorg.apache.hadoop.io.nativeio.NativeIO$Windows.access(NativeIO.java:557)我们来看这个类NativeIO的557行
Windows的唯一方法用于检查当前进程的请求,在给定的路径的访问权限, 允许访问, 先修改源代码,return true 时允许访问
public static boolean access(String path, AccessRight desiredAccess)
throws IOException {
return true;
//return access0(path, desiredAccess.accessRight());
}
5.新建包org.apache.hadoop.io.nativeio,复制文件NativeIO,运行ok