【问题标题】:NullPointerException with MR2 in windowsWindows 中带有 MR2 的 NullPointerException
【发布时间】:2014-05-19 09:40:11
【问题描述】:

我已经在 windows 中安装了 Hadoop 2.3.0 并且能够成功执行 MR 作业。但是在尝试使用 C# 中的流式示例 [使用 HadoopSDK 的 .Net 程序集] 时,应用程序以以下异常结束

14/05/16 18:21:06 INFO mapreduce.Job: Task Id : attempt_1400239892040_0003_r_000000_0, Status : FAILED
Error: java.lang.NullPointerException
at org.apache.hadoop.mapred.Task.getFsStatistics(Task.java:347)
at org.apache.hadoop.mapred.ReduceTask$OldTrackingRecordWriter.<init>(ReduceTask.java:478)
at org.apache.hadoop.mapred.ReduceTask.runOldReducer(ReduceTask.java:414)
at org.apache.hadoop.mapred.ReduceTask.run(ReduceTask.java:392)
at org.apache.hadoop.mapred.YarnChild$2.run(YarnChild.java:168)
at java.security.AccessController.doPrivileged(Native Method)
at javax.security.auth.Subject.doAs(Subject.java:415)
at org.apache.hadoop.security.UserGroupInformation.doAs(UserGroupInformation.java:1548)
at org.apache.hadoop.mapred.YarnChild.main(YarnChild.java:163)

更新:

我能够深入问题并发现以下行中引发了异常

 matchedStats = getFsStatistics(FileOutputFormat.getOutputPath(job), job);

at org.apache.hadoop.mapred.ReduceTask$OldTrackingRecordWriter.<init>(ReduceTask.java:478)

上面'FileOutputFormat.getOutputPath(job)'的结果返回null,抛出空指针异常。下面是 getOutputPath() 函数的代码。

public static final String OUTDIR = "mapreduce.output.fileoutputformat.outputdir";

  public static Path getOutputPath(JobConf conf) {
  String name = conf.get(org.apache.hadoop.mapreduce.lib.output.
  FileOutputFormat.OUTDIR);
  return name == null ? null: new Path(name);
  }

那么是否需要在配置文件中的任何位置设置属性“mapreduce.output.fileoutputformat.outputdir”的值才能解决此问题?

谢谢

【问题讨论】:

    标签: c# hadoop mapreduce hadoop-streaming


    【解决方案1】:

    问题在于 hadoop 服务是从不同的用户 [在我的情况下为 SYSTEM] 启动的,并且 mapreduce 示例是从我的本地用户提交的。因此,这会通过将 [本地用户] 的文件系统统计信息返回为 Null 来解决问题。

    一旦我从本地用户启动 Hadoop,上述问题就会得到解决。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2021-04-17
      • 1970-01-01
      • 2015-12-06
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多