我在下面提到的行中得到了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.
请告诉我为什么会发生这样的事情
如果你在类路径上没有核心站点.xml,那么你需要指定 HDFS 位置(否则默认为本地文件系统(
例如
hdfs://namenode.fqdn:8020/WordCount