0

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) 
Karol Dowbecki
  • 43,645
  • 9
  • 78
  • 111
turosng
  • 3
  • 1
  • 2

1 Answers1

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());
VanThaoNguyen
  • 792
  • 9
  • 20