I am unable to read a file from HDFS using Java:
String hdfsUrl = \"hdfs://:\";
Configuration configuration = new Configuration();
conf
Try this:
Configuration configuration = new Configuration();
FileSystem fs = FileSystem.get(new URI(<url:port>), configuration);
Path filePath = new Path(<path/to/file>);
FSDataInputStream fsDataInputStream = fs.open(filePath);
BufferedReader br = new BufferedReader(new InputStreamReader(fsDataInputStream));
Please refer to http://techidiocy.com/java-lang-illegalargumentexception-wrong-fs-expected-file/
A similar problem is addressed.
Also below Configuration works!
Configuration conf = new Configuration();
conf.addResource(new Path("/usr/hdp/2.6.3.0-235/hadoop/etc/hadoop/core-site.xml"));
FileSystem fs = FileSystem.get(conf);