hdfs文件路径问题

fjnneemd  于 2021-06-01  发布在  Hadoop
关注(0)|答案(1)|浏览(504)

我在下面提到的行中得到filenotfoundexception。在hadoop1早期,这是功能性的。但现在它抛出了一个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.

请告诉我为什么会发生这种事

h4cxqtbf

h4cxqtbf1#

如果类路径上没有core-site.xml,则需要指定hdfs位置(否则默认为本地文件系统)
例如

hdfs://namenode.fqdn:8020/WordCount

相关问题