在windows下用Eclipse运行MapReduce程序会报错:

12/04/24 15:32:44 WARN util.NativeCodeLoader: Unable to load native-hadoop     library for your platform... using builtin-java classes where applicable
12/04/24 15:32:44 ERROR security.UserGroupInformation:     PriviledgedActionException as:Administrator cause:java.io.IOException: Failed to set     permissions of path: \tmp\hadoop-Administrator\mapred\staging\Administrator-    519341271\.staging to 0700
Exception in thread "main" java.io.IOException: Failed to set permissions of path: \tmp\hadoop-Administrator\mapred\staging\Administrator-519341271\.staging to 0700

这个问题在网上很常见了, 搜下有很多, 原因和解决方案:

这个是Windows下文件权限问题,在Linux下可以正常运行,不存在这样的问题。

解决方法是将hadoop-x.x.x/src/core/org/apache/hadoop/fs/FileUtil.java里面方法checkReturnValue的代码注释掉.

再重新编译生成hadoop-x.x.x-core.jar.

关键问题是怎么重新编译? 于是网上找怎么编译Hadoop的方法, 本来一个很简单的问题弄了很久都没解决掉.

其实方法很简单, 不用重新编译Hadoop, 仅编译FileUtil.java即可.

新建一个MapReduce项目, 把hadoop-x.x.x/src/core/org/apache/hadoop/fs/FileUtil.java代码复制到src下(注意, 目录结构也需要), 按上面修改文件, 然后重新build下, 找到编译好的.class(两个), 用解压软件打开hadoop-x.x.x-core.jar, 把这两个class文件覆盖即可.

相关文章:

  • 2021-06-11
  • 2022-12-23
  • 2022-01-15
  • 2022-02-08
  • 2022-12-23
  • 2022-12-23
  • 2021-12-17
  • 2021-11-25
猜你喜欢
  • 2021-05-04
  • 2021-07-13
  • 2021-07-21
  • 2021-11-23
  • 2022-12-23
  • 2022-12-23
  • 2021-09-04
相关资源
相似解决方案