java.lang.IllegalArgumentException: Wrong FS: hdfs://10.196.80.90:9000/message.xml, expected: file:///
这个错误我把我折磨死了,源码如下:
Configuration conf = new Configuration();
FileSystem hdfs = FileSystem.get(conf);
FSDataInputStream in = null;
in = hdfs.open(new Path("hdfs://10.196.80.90:9000/message.xml"))
完全没弄明白怎么回事,不过最后还是解决了
Configuration conf = new Configuration();
conf.addResource(new Path("D:/hadoop/conf/core-site.xml"));
FileSystem hdfs = FileSystem.get(conf);
FSDataInputStream in = null;
这样就可以了。不过还是不明白为什么