在windows下使用Hadoop,作业提交时出现Can not create a Path from an empty string异常

tech2024-07-07  66

问题描述:

在windows下重写MapReduce,driver中的job.waitForCompletion(true);出错。出错信息如下

Exception in thread “main” java.lang.IllegalArgumentException: Can not create a Path from an empty string at org.apache.hadoop.fs.Path.checkPathArg(Path.java:127) at org.apache.hadoop.fs.Path.(Path.java:135) at org.apache.hadoop.fs.Path.(Path.java:94) at org.apache.hadoop.mapred.LocalJobRunner$Job.(LocalJobRunner.java:156) at org.apache.hadoop.mapred.LocalJobRunner.submitJob(LocalJobRunner.java:731) at org.apache.hadoop.mapreduce.JobSubmitter.submitJobInternal(JobSubmitter.java:241) at org.apache.hadoop.mapreduce.Job$10.run(Job.java:1297) at org.apache.hadoop.mapreduce.Job$10.run(Job.java:1294) at java.security.AccessController.doPrivileged(Native Method) at javax.security.auth.Subject.doAs(Subject.java:422) at org.apache.hadoop.security.UserGroupInformation.doAs(UserGroupInformation.java:1656) at org.apache.hadoop.mapreduce.Job.submit(Job.java:1294) at org.apache.hadoop.mapreduce.Job.waitForCompletion(Job.java:1314) at forKPI.Browser.ForReducer.main(ForReducer.java:43)

问题分析:

在进行debug之后发现,Path中的这一块

checkPathArg( pathString );

会有一次传入空串,导致path.length()为0,导致报错。继续debug发现,在LocalJobRunner中

String user = UserGroupInformation.getCurrentUser().getShortUserName();

获取到的用户名为空。在参考了这篇博客后 https://blog.csdn.net/sdk0925/article/details/100515637

尝试修改了下用户名,并重启,重新运行还是不行。在困扰了四五天之后,认为是用户名修改未生效。

解决方案:

使用Microsoft登录,再改用本地账户登录,问题解决。

最新回复(0)