我的代码中有这一行:
DistributedFileSystem.get(conf).delete(new Path(new URI(otherArgs[1])), true);
otherArgs[1]
具有此值:hdfs://master:54310/input/results
我收到此异常:
Exception in thread "main" java.lang.IllegalArgumentException: Wrong FS:hdfs://master:54310/input/results, expected: file:///
at org.apache.hadoop.fs.FileSystem.checkPath(FileSystem.java:354)
at org.apache.hadoop.fs.RawLocalFileSystem.pathToFile(RawLocalFileSystem.java:55)
at org.apache.hadoop.fs.RawLocalFileSystem.getFileStatus(RawLocalFileSystem.java:367)
at org.apache.hadoop.fs.ChecksumFileSystem.delete(ChecksumFileSystem.java:430)
at <package>.<classname>.main(Degree.java:137)
注意:我尝试使用不带URI的
new Path(otherArgs[1])
,但得到了完全相同的错误!谢谢,
-K
最佳答案
看来您尚未在core-site.xml中设置 fs.default.name 。
检查这个link
如果已经设置,请确保配置文件在类路径中
您也可以从驱动程序设置fs.default.name属性
conf.set("fs.default.name", "hdfs://yourserver:port");