Exception in thread "main" java.io.FileNotFoundException: File does not exist: hdfs://master:8020/user/seletedata/part-r-0000
at org.apache.hadoop.hdfs.DistributedFileSystem$18.doCall(DistributedFileSystem.java:1122)
at org.apache.hadoop.hdfs.DistributedFileSystem$18.doCall(DistributedFileSystem.java:1114)
at org.apache.hadoop.fs.FileSystemLinkResolver.resolve(FileSystemLinkResolver.java:81)
at org.apache.hadoop.hdfs.DistributedFileSystem.getFileStatus(DistributedFileSystem.java:1114)
at org.apache.hadoop.io.SequenceFile$Reader.<init>(SequenceFile.java:1817)
at org.apache.hadoop.io.SequenceFile$Reader.<init>(SequenceFile.java:1841)
at org.apache.hadoop.hdfs.DistributedFileSystem$18.doCall(DistributedFileSystem.java:1122)
at org.apache.hadoop.hdfs.DistributedFileSystem$18.doCall(DistributedFileSystem.java:1114)
at org.apache.hadoop.fs.FileSystemLinkResolver.resolve(FileSystemLinkResolver.java:81)
at org.apache.hadoop.hdfs.DistributedFileSystem.getFileStatus(DistributedFileSystem.java:1114)
at org.apache.hadoop.io.SequenceFile$Reader.<init>(SequenceFile.java:1817)
at org.apache.hadoop.io.SequenceFile$Reader.<init>(SequenceFile.java:1841)
at ReadSequenceFile.main(ReadSequenceFile.java:43)
仔细查看了一下代码 问题出现在其中一行
SequenceFile.Reader reader=new SequenceFile.Reader(fs, new Path("/user/seletedata/part-r-00000"), conf);
应该为:
SequenceFile.Reader reader=new SequenceFile.Reader(fs, new Path("/user/seletedata/part-m-00000"), conf);
如果用这个文件part-r-00000显示不存在 part-m-00000 才行 SequenceFile.Reader(part-r-00000)为什么读不了 路过的可以留言解释谢谢