简体   繁体   English

Hadoop 2中的HDFS文件路径问题

[英]HDFS file path issue in Hadoop 2

I am getting fileNotFoundException in the mentioned line below. 我在下面提到的行中收到fileNotFoundException。 Earlier in Hadoop 1 this was functional. 在Hadoop 1的早期版本中,这是有效的。 But now it throws a FileNotFoundException 但是现在它抛出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;
        }

Exception : 例外情况:

java.io.FileNotFoundException: File hdfs:/WordCount/write does not exist.

Please tell me why such thing is happening 请告诉我为什么会这样

If you do not have your core-site.xml on the classpath, then you need to specify the HDFS location (otherwise defaults to local filesystem) 如果您的类路径上没有core-site.xml,则需要指定HDFS位置(否则默认为本地文件系统)

For example 例如

hdfs://namenode.fqdn:8020/WordCount

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM