"Hadoop"--modifying Hadoop Fileutil.java To resolve permissions check issues

Source: Internet
Author: User

in the Hadoop Eclipse Development Environment Building In this article, the 15th.) mentions permission-related exceptions, as follows:

15/01/30 10:08:17 WARN util. nativecodeloader:unable to load Native-hadoop library for your platform ... using Builtin-java classes where applicable15/ 01/30 10:08:17 ERROR Security. Usergroupinformation:priviledgedactionexception As:zhangchao3 cause:java.io.IOException:Failed to set permissions of Path: \tmp\hadoop-zhangchao3\mapred\staging\zhangchao3502228304\.staging to 0700Exception in thread "main" Java.io.IOException:Failed to set permissions of path: \tmp\hadoop-zhangchao3\mapred\staging\zhangchao3502228304\. Staging to 0700 atOrg.apache.hadoop.fs.FileUtil.checkReturnValue (fileutil.java:689)    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:856) at Org.apache.hadoop.mapred.jobclient$2.run ( jobclient.java:850) at java.security.AccessController.doPrivileged (Native Method) at javax.security.auth.Subject.do As (subject.java:415) at Org.apache.hadoop.security.UserGroupInformation.doAs (usergroupinformation.java:1121) at Org.apache.hadoop.mapred.JobClient.submitJobInternal (jobclient.java:850) at Org.apache.hadoop.mapreduce.Job.submit (job.java:500) at Org.apache.hadoop.mapreduce.Job.waitForCompletion ( job.java:530) at Org.apache.hadoop.examplEs. Wordcount.main (wordcount.java:68)

According to the prompt information, you can see that this exception is Org.apache.hadoop.fs.FileUtil.checkReturnValue (fileutil.java:689) line thrown out, the source code of this location to paste out, study:

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", Permiss Ion.toshort ()));    }  }

In the above exception information, the fileutil.java:689 line is the throw new IOException ("Failed to ..., I will directly remove the IF statement of this function, as follows:

private static void Checkreturnvalue (Boolean rv, File p, fspermission permission)    throws IOException  {}

In this way, Chekreturnvalue becomes an empty function so that permissions are not checked, executed in/home/hadoop/hadoop-1.0.3/, the Ant Jar is compiled, and problems that may be encountered in the compilation are as follows: compiling Hadoop encounters maven Timeout, after compiling, generate the following file:

Copy the generated Hadoop-core-1.0.4-snapshot.jar file to Windows and use Java decoder to see that the Checkreturnvalue has been modified:

Change the Hadoop-core-1.0.4-snapshot.jar to Hadoop-core-1.0.3.jar file, overwriting the Hadoop-core-1.0.3.jar file in the Eclipse project:

------》

rerun run on Hadoop and it will run successfully. (How to execute run on Hadoop see:Hadoop Eclipse Development Environment Build 11 section)

Modified JAR Package: http://download.csdn.net/download/uestczhangchao/8420249

"Hadoop"--modifying Hadoop Fileutil.java To resolve permissions check issues

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.