[英]HDFS file path issue in Hadoop 2
我在下面提到的行中收到fileNotFoundException。 在Hadoop 1的早期版本中,这是有效的。 但是现在它抛出FileNotFoundException
Path localManifestFolder;
Path localManifestPath = new Path("hdfs:///WordCount/write/manifest");
PrintWriter pw = null;
FileSystem fs = null;
try {
URI localHDFSManifestUri = new URI("
hdfs:///WordCount/write");
fs = FileSystem.get(localHDFSManifestUri, conf);
localManifestFolder = new Path("hdfs:///WordCount/write");
FileStatus[] listOfFiles = fs.listStatus(localManifestFolder); // Getting Error in this line
} catch (FileNotFoundException ex) {
throw ex;
}
例外情况:
java.io.FileNotFoundException: File hdfs:/WordCount/write does not exist.
请告诉我为什么会这样
如果您的类路径上没有core-site.xml,则需要指定HDFS位置(否则默认为本地文件系统)
例如
hdfs://namenode.fqdn:8020/WordCount
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.