Win下Eclipse提交hadoop程序出错:org.apache.hadoop.security.AccessControlException: Permission denied:

时间:2022-09-10 15:37:47

    Win下Eclipse提交hadoop程序出错:org.apache.hadoop.security.AccessControlException: Permission denied: user=administrator, access=WRITE

描述:在window下使用Eclipse进行hadoop的程序编写,然后Run on hadoop 后,出现如下错误:

11/10/28 16:05:53 INFO mapred.JobClient: Running job: job_201110281103_0003
11/10/28 16:05:54 INFO mapred.JobClient: map 0% reduce 0%
11/10/28 16:06:05 INFO mapred.JobClient: Task Id : attempt_201110281103_0003_m_000002_0, Status : FAILED
org.apache.hadoop.security.AccessControlException: org.apache.hadoop.security.AccessControlException: Permission denied: user=administrator, access=WRITE, inode="hadoop":hadoop:supergroup:rwxr-xr-x
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:39)

        因为Eclipse使用hadoop插件提交作业时,会默认以administrator身份去将作业写入hdfs文件系统中,对应的也就是 HDFS 上的/user/xxx , 我的为/user/hadoop ,   由于 administrator 用户对hadoop目录并没有写入权限,所以导致异常的发生。解决方法为:放开 hadoop 目录的权限 , 命令如下 :$hadoop fs -chmod 777 /user/hadoop