日期:2014-05-16  浏览次数:21258 次

MapReduce运行异常-- org.apache.hadoop.mapred.FileAlreadyExistsException

描述: 输出文件已经存在

异常

14/03/26 23:00:52 WARN mapred.JobClient: No job jar file set.  User classes may not be found. See JobConf(Class) or JobConf#setJar(String).
14/03/26 23:00:52 INFO mapred.JobClient: Cleaning up the staging area hdfs://xxx/opt/liveEpg/hadoop/hadoop_tmp/hadoop_hadoop/mapred/staging/allen/.staging/job_201312291735_0013
14/03/26 23:00:52 ERROR security.UserGroupInformation: PriviledgedActionException as:allencause:org.apache.hadoop.mapred.FileAlreadyExistsException: Output directory hdfs://xxx/mr/sort/sort_out already exists
Exception in thread "main" org.apache.hadoop.mapred.FileAlreadyExistsException: Output directory hdfs://xxx/mr/sort/sort_out already exists
at org.apache.hadoop.mapreduce.lib.output.FileOutputFormat.checkOutputSpecs(FileOutputFormat.java:137)
at org.apache.hadoop.mapred.JobClient$2.run(JobClient.java:887)
at org.apache.hadoop.mapred.JobClient$2.run(JobClient.java:850)
at java.security.AccessController.doPrivileged(Native Method)
at javax.security.auth.Subject.doAs(Subject.java:396)
at org.apache.hadoop.security.UserGroupInformation.doAs(UserGroupInformation.java:1121)
at org.apache.hadoop.mapred.JobClient.submitJobInternal(JobClient.java:850)
at org.apache.hadoop.mapreduce.Job.submit(Job.java:500)
at org.apache.hadoop.mapreduce.Job.waitForCompletion(Job.java:530)
at smiple.Sort.main(Sort.java:84)

解决办法:

将输出目录中相关文件删除,我一般直接将输出目录删了

命令hadoop fs -rmr /mr/sort/sort_out