1

I'm trying to create a file in Hadoop using Java client (just a test case). The exception below was thrown:

Exception in thread "main" java.io.IOException: Mkdirs failed to create /app2/speed (exists=false, cwd=file:/home/cpu-local/NetBeansProjects/hdoops) 
    at org.apache.hadoop.fs.ChecksumFileSystem.create(ChecksumFileSystem.java:450) 
    at org.apache.hadoop.fs.ChecksumFileSystem.create(ChecksumFileSystem.java:435) 
    at org.apache.hadoop.fs.FileSystem.create(FileSystem.java:909) 
    at org.apache.hadoop.fs.FileSystem.create(FileSystem.java:890) 
    at org.apache.hadoop.fs.FileSystem.create(FileSystem.java:787) 
    at org.apache.hadoop.fs.FileSystem.create(FileSystem.java:776) 
    at com.abc.hadoop.Test.main(Test.java:35) 
5
  • Possible duplicate of Hadoop java.io.IOException: Mkdirs failed to create /some/path Commented Jul 18, 2017 at 12:17
  • I check that case already. But it nope. Commented Jul 18, 2017 at 12:19
  • Is that an hdfs location, or local filesystem? Commented Jul 18, 2017 at 12:23
  • If local, you try to run mkdir /app2/speed in your regular Terminal, and it'll likely fail with permission denied because you're making a root directory Commented Jul 18, 2017 at 12:26
  • Please show the code. Commented Jul 18, 2017 at 12:29

1 Answer 1

1

Becase of failing in create FileSystem through java client, all you need is setting your java client appropriate the hadoop configuration (in file config).

Configuration hadoopConfig = new Configuration();
hadoopConfig.set("fs.defaultFS", "hdfs://localhost:9000/");
hadoopConfig.set("fs.hdfs.impl", org.apache.hadoop.hdfs.DistributedFileSystem.class.getName());
hadoopConfig.set("fs.file.impl", org.apache.hadoop.fs.LocalFileSystem.class.getName());
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.