【问题标题】:Input file not recognized in hadoop jar commandhadoop jar命令中无法识别输入文件
【发布时间】:2015-07-03 21:08:26
【问题描述】:
WARN util.NativeCodeLoader: Unable to load native-hadoop library for your platform... using builtin-java classes where applicable
Exception in thread "main" java.io.FileNotFoundException: File /usr/hdfs/Deliverydetails.txt does not exist.
at org.apache.hadoop.util.GenericOptionsParser.validateFiles(GenericOptionsParser.java:397)
at org.apache.hadoop.util.GenericOptionsParser.processGeneralOptions(GenericOptionsParser.java:301)
at org.apache.hadoop.util.GenericOptionsParser.parseGeneralOptions(GenericOptionsParser.java:431)
at org.apache.hadoop.util.GenericOptionsParser.<init>(GenericOptionsParser.java:170)
at org.apache.hadoop.util.GenericOptionsParser.<init>(GenericOptionsParser.java:153)
at org.apache.hadoop.util.ToolRunner.run(ToolRunner.java:64)
at SmsDriver.main(SmsDriver.java:44)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:606)
at org.apache.hadoop.util.RunJar.main(RunJar.java:212)

这是我在运行 hadoop jar 命令时遇到的错误,尽管输入文件存在于我在浏览器中检查的路径中。

谁能帮帮我?

【问题讨论】:

  • 相关源码?最好有一小段可以重现问题的演示代码。
  • 这是我编译并创建了一个名为 SmsDriver 的 jar 文件的实际程序,在 hadoop jar 命令之后,这是我得到的输出 kickstarthadoop.blogspot.in/2011/09/…
  • 哪个用户在运行 MR 作业?
  • 唯一的 hduser 正在运行主文件 SmsDriver

标签: java hadoop mapreduce ubuntu-14.04 ioexception


【解决方案1】:

确保 /usr/hdfs/ 是 HDFS 文件路径,而不是本地文件系统路径。

【讨论】:

  • 只是HDFS文件路径,不是本地文件系统路径。该文件也位于 HDFS 文件路径中
  • 所以我希望您没有提供带文件名的完整路径,而是提供了输入目录,而不是输入位置。
  • 不,实际上它没有授予在 HDFS 文件路径中创建输入目录的权限,因此尝试仅将这 3 个输入文件放在目录中并尝试。也尝试了文件路径,但都没有工作
【解决方案2】:

尝试做 hadoop fs -ls /usr/hdfs/Deliverydetails.txt 如果它不存在,那么您的文件存在于本地文件系统而不是 hadoop 文件系统中

【讨论】:

  • 它存在于 hadoop 文件系统中。在上述命令之后,这是输出 Found 1 items -rw-r--r-- 1 hduser supergroup 54 2015-04-24 11:58 /usr/hdfs/Deliverydetails.txt
  • 你能不能试试改变这个hadoop文件的权限。使用这个命令 hadoop fs -chmod 777 /usr/hdfs/Deliverydetails.txt。有时这可能是用户面临的问题。
  • 您是将输入文件路径作为参数传递还是通过驱动程序类传递。如果您可以在此处粘贴您的驱动程序类代码以供参考,将会很有帮助。
  • 是 将输入作为参数传递,这里是驱动程序代码 public class SmsDriver extends Configured implements Tool { public int run(String[] args) throws Exception { JobConf conf = new JobConf(getConf() , SmsDriver.class); conf.setJobName("短信报告"); conf.setOutputKeyClass(Text.class); conf.setOutputValueClass(Text.class); conf.setReducerClass(SmsReducer.class);
  • MultipleInputs.addInputPath(conf, new Path(args[0]), TextInputFormat.class, UserFileMapper.class); MultipleInputs.addInputPath(conf, new Path(args[1]), TextInputFormat.class, DeliveryFileMapper.class); FileOutputFormat.setOutputPath(conf, new Path(args[2])); JobClient.runJob(conf);返回0; } public static void main(String[] args) throws Exception { int res = ToolRunner.run(new Configuration(), new SmsDriver(),args); System.exit(res); } }
猜你喜欢
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2021-06-19
  • 1970-01-01
相关资源
最近更新 更多