错误信息:
Exception in thread "main" java.io.IOException:Failed to set permissions of path:\tmp\hadoop-ysc\mapred\staging\ysc-2036315919\.staging to 0700
解决方案(经笔者在hadoop1.2.0+jdk1.7下验证通过):
0.安装jdk,ant,并且配置好环境变量
安装配置jdk不再多说,ant参考我的文章: http://blog.csdn.net/shan9liang/article/details/8948646
1.首先到官网上把该版本hadoop的tar包下载下来,并解压到$HADOOP_HOME目录下
2.修改hadoop-1.2.0\src\core\org\apache\hadoop\fs下的FileUtil类 private static void checkReturnValue(boolean rv, File p, FsPermission permission ) throws IOException { if (!rv) { throw new IOException("Failed to set permissions of path: " + p + " to " + String.format("%04o", permission.toShort())); } }
将这个抛异常操作注释掉或者把throw new IOException改为LOG.warn
3.进入到$HADOOP_HOME/src目录中,修改saveVersion.sh文件,因为原saveVersion.sh生成的package-info.java有问题。更正内容为:
user=`whoami` #此处修改成固定值,如user=jialin
3、修改$HADOOP_HOME\build.xml,搜索autoreconf,移除匹配的6个executable="autoreconf"的exec配置 ,如: <exec executable="autoreconf" dir="${c++.task-controller.src}" searchpath="yes" failonerror="yes"> <arg value="-i"/> </exec> 共有6处,将该语言块删除
4、 修改hadoop安装目录下的\build.xml 指定java版本<property name="javac.version" value="1.6"/> 如是1.7就改为1.7
5、在命令行切换到$HADOOP_HOME,执行ant
6、用新生成的$HADOOP_HOME\build\hadoop-core-1.*.*-SNAPSHOT.jar替换nutch的hadoop-core-*.*.*.jar
我已经编译好了一个,下载地址:http://download.csdn.net/detail/shan9liang/5946607