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 --------------------------------------