在idea上运行MR项目,作业提交出现 Can not create a Path from an empty string异常

换了台电脑,重装了idea,运行原来的项目时总会报一些奇怪的异常。

这是主方法:

public static void main(String[] args) throws IOException, ClassNotFoundException, InterruptedException {
    Job job= Job.getInstance();
    job.setMapperClass(ForBrowser.class);
    job.setReducerClass(ForReducer.class);
    job.setMapOutputKeyClass(Text.class);
    job.setMapOutputValueClass(IntWritable.class);
    job.setOutputKeyClass(Text.class);
    job.setOutputValueClass(IntWritable.class);
    Path outputpath=new Path("E:\\MapRaduce\\forcount\\target\\output\\kpi\\browser");
    Path inputpath=new Path("E:\\MapRaduce\\forcount\\output");
    FileInputFormat.setInputPaths(job,inputpath);
    FileOutputFormat.setOutputPath(job,outputpath);
    job.waitForCompletion(true);
}

运行后在job.waitForCompletion(true);这一句出现空指针异常。上网查找方法说将hadoop.dll文件放在Ststem32文件夹下,放完之后异常变成Can not create a Path from an empty string。

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:1315)
    at forKPI.Browser.ForReducer.main(ForReducer.java:40)

代码是没有问题的,在原来的机器上正常运行,应该是idea配置的问题,希望看到的大佬帮忙解答下。谢谢!!!!

 

你可能感兴趣的:(hadoop,idea)