windows下Eclipse操作MapReduce例子报错:
14/05/18 22:05:29 WARN util.NativeCodeLoader: Unable to load native-hadoop library for your platform... using builtin-java classes where applicable 14/05/18 22:05:29 ERROR security.UserGroupInformation: PriviledgedActionException as:Jerome cause:java.io.IOException: Failed to set permissions of path: \tmp\hadoop-Jerome\mapred\staging\Jerome-604193941\.staging to 0700 Exception in thread "main" java.io.IOException: Failed to set permissions of path: \tmp\hadoop-Jerome\mapred\staging\Jerome-604193941\.staging to 0700 at org.apache.hadoop.fs.FileUtil.checkReturnValue(FileUtil.java:692) at org.apache.hadoop.fs.FileUtil.setPermission(FileUtil.java:662) at org.apache.hadoop.fs.RawLocalFileSystem.setPermission(RawLocalFileSystem.java:509) at org.apache.hadoop.fs.RawLocalFileSystem.mkdirs(RawLocalFileSystem.java:344) at org.apache.hadoop.fs.FilterFileSystem.mkdirs(FilterFileSystem.java:189) at org.apache.hadoop.mapreduce.JobSubmissionFiles.getStagingDir(JobSubmissionFiles.java:116) at org.apache.hadoop.mapred.JobClient$2.run(JobClient.java:918) at org.apache.hadoop.mapred.JobClient$2.run(JobClient.java:912) at java.security.AccessController.doPrivileged(Native Method) at javax.security.auth.Subject.doAs(Subject.java:396) at org.apache.hadoop.security.UserGroupInformation.doAs(UserGroupInformation.java:1149) at org.apache.hadoop.mapred.JobClient.submitJobInternal(JobClient.java:912) at org.apache.hadoop.mapreduce.Job.submit(Job.java:500) at org.apache.hadoop.mapreduce.Job.waitForCompletion(Job.java:530) at mapreduce2.WordCountApp.main(WordCountApp.java:50)
网上查询了下,这个是Windows下文件权限问题,在Linux下可以正常运行,不存在这样的问题。
修改hadoop-core-1.1.2.jar包中的org.apache.hadoop.fs.FileUtil.checkReturnValue方法,把该方法的方法体注释掉就可以了,具体操作可以参考
修改源码方法:http://blog.csdn.net/jerome_s/article/details/26171343