hadoop程序问题:java.lang.IllegalArgumentException: Wrong FS: hdfs:/ expected file:///

来源:互联网 发布:小米怎么备份所有数据 编辑:程序博客网 时间:2024/05/22 13:45

FileSystem fs = FileSystem.get(conf);
in=fs.open(newPath("hdfs://192.168.130.54:19000/user/hmail/output/part-00000"));

抛出异常:

Exception in thread "main" java.lang.IllegalArgumentException: Wrong FS: hdfs://192.168.130.54:19000/user/hmail/output/part-00000, expected: file:/// 

解决方案:

hadoop需要把集群上的core-site.xml和hdfs-site.xml放到当前工程下。eclipse工作目录的bin文件夹下面

因为是访问远程的HDFS 需要通过URI来获得FileSystem.

0 0