【问题标题】:Getting "Array out of bound exception" Error while running mapreduce in cloudera VM在 cloudera VM 中运行 mapreduce 时出现“Array out of bound exception”错误
【发布时间】:2021-03-21 23:56:11
【问题描述】:

我正在尝试在 Cloudera VM 上运行我的第一个字数统计。我得到了

Exception in thread "main" java.lang.ArrayIndexOutOfBoundsException: 0
at new_pack.word.main(word.java:52)

这个错误在线:

FileInputFormat.setInputPaths(conf, new Path(args[0]));

在驱动程序类中。

我已经复制了这个 Cloudera tutorial 中提到的代码。

【问题讨论】:

  • 你有没有传递任何命令行参数?

标签: java hadoop mapreduce


【解决方案1】:

如第 5 步中https://docs.cloudera.com/documentation/other/tutorial/CDH5/topics/ht_usage.html 所述,您需要使用命令行参数运行作业,指定在何处查找输入文件以及在何处写入输出:

$ hadoop jar wordcount.jar org.myorg.WordCount /user/cloudera/wordcount/input /user/cloudera/wordcount/output

【讨论】:

    猜你喜欢
    • 2020-08-09
    • 1970-01-01
    • 2021-02-06
    • 2017-02-03
    • 2012-11-04
    • 1970-01-01
    • 2012-12-26
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多