An error is reported when Eclipse is connected to Hadoop in Win7. The following is a simple solution: Re-compile FileUtil. java.

Source: Internet
Author: User

An error is reported when Eclipse is connected to Hadoop in Win7. The following is a simple solution: Re-compile FileUtil. java.

When you connect to the Hadoop1.2.1 cluster through Eclipse in Win7, the following error occurs:
Exception in thread "main" java. io. IOException: Failed to set permissions of path: \ tmp \ hadoop-Administrator \ mapred \ staging \ Administrator-519341271 \. staging to 0700

In this case, you only need to modify the org. apache. hadoop. fs. FileUtil file and re-compile it. The steps are as follows:

1. Create a java project in eclipse

2. Import hadoop-related jar packages to the project.

3. Copy the src/core/org/apache/hadoop/fs/FileUtil. java file to the source code and paste it to the src directory of the eclipse project.

4. Locate the following sections and comment out the code in the checkReturnValue method.

Private static void checkReturnValue (boolean rv, File p,

FsPermission permission

) Throws IOException {

/*

// Win7 connect to linux hadoop

If (! Rv ){

Throw new IOException ("Failed to set permissions of path:" + p +

"To" +

String. format ("% 04o", permission. toShort ()));

}

*/

}

5. Find the class file in the project output directory. There will be two class files because FileUtil. java has internal classes.

6. Add the class file to the corresponding directory in the hadoop-core-1.2.1.jar to overwrite the original file

7. Copy the updated hadoop-core-1.2.1.jar to the Hadoop cluster, overwrite the original file, restart the Hadoop Cluster

8. Add the updated hadoop-core-1.2.1.jar to the dependencies of the project. If Maven is used, it may involve overwriting the corresponding files in the Maven library.

9. Run the program. Everything is fine !!!

-------------------------------------- Split line --------------------------------------

Build a Hadoop environment on Ubuntu 13.04

Cluster configuration for Ubuntu 12.10 + Hadoop 1.2.1

Build a Hadoop environment on Ubuntu (standalone mode + pseudo Distribution Mode)

Configuration of Hadoop environment in Ubuntu

Detailed tutorial on creating a Hadoop environment for standalone Edition

-------------------------------------- Split line --------------------------------------

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.