java.lang.IllegalArgumentException: Wrong FS: hdfs://, expected: file:

參考:https://stackoverflow.com/questions/32078441/wrong-fs-expected-file-when-trying-to-read-file-from-hdfs-in-java

解決辦法:參照下文修改文件訪問方式。

原文如下:

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.

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章