Hdfs file permission

I want to change file permission but this error involved.

Hadoop version : 1.0.3

Netbeans IDE 7.4

JDK = 7u45

Java code :

    Configuration conf = new Configuration();
    conf.addResource(new Path("/home/furkanb/hadoop-1.0.3/conf/core-site.xml"));
    conf.addResource(new Path("/home/furkanb/hadoop-1.0.3/conf/hdfs-site.xml"));
    FileSystem fileSystem = FileSystem.get(conf);

    ......

    fileSystem.setPermission(new Path(file), FsPermission.createImmutable((short) 0777));

    fileSystem.close();

I meet to Error:

Exception in thread "main" java.io.IOException: Call to /127.0.0.1:9000 failed on local exception: java.io.EOFException
    at org.apache.hadoop.ipc.Client.wrapException(Client.java:1107)
    at org.apache.hadoop.ipc.Client.call(Client.java:1075)
    at org.apache.hadoop.ipc.RPC$Invoker.invoke(RPC.java:225)
    at com.sun.proxy.$Proxy1.setPermission(Unknown Source)

How can i fix it?

Answers


Solution:

fileSystem.setPermission(fileStatus.getPath(), FsPermission.valueOf(permission));

permission = unix permission code, example = drwxr-x--x


It seems you are having a version mismatch problem. This error can occur when the version on Hadoop machines and your client version differ.

If you are using Maven, you can update your pom.xml as below:

<dependency>
    <groupId>org.apache.hadoop</groupId>
    <artifactId>hadoop-client</artifactId>
    <version>1.0.3</version>
</dependency>

Need Your Help

iPhone6 view size is smaller with autolayout

ios iphone autolayout iphone-6

I have added autolayout but no size class.. I get this in iPhone 6 simulator..

Can AssemblyName.Version throw an error?

c# exception version .net-assembly

I want to know if AssemblyName.Version could ever encounter an error, for example when trying to retrieve it from the manifest file.