Reputation: 13
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)
Upvotes: 1
Views: 4101
Reputation: 812
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());
Upvotes: 1