簡體   English   中英

Hadoop 2中的HDFS文件路徑問題

[英]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.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM