mapreduce报错java.lang.InstantiationException

2021-04-13 03:27

阅读:704

标签:bin   log   logs   cti   mapreduce   map   spec   tor   red   

一、报错信息:

Exception in thread "main" java.lang.RuntimeException: java.lang.InstantiationException
at org.apache.hadoop.util.ReflectionUtils.newInstance(ReflectionUtils.java:131)
at org.apache.hadoop.mapreduce.JobSubmitter.checkSpecs(JobSubmitter.java:267)
at org.apache.hadoop.mapreduce.JobSubmitter.submitJobInternal(JobSubmitter.java:143)
at org.apache.hadoop.mapreduce.Job$10.run(Job.java:1307)
at org.apache.hadoop.mapreduce.Job$10.run(Job.java:1304)
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:1917)
at org.apache.hadoop.mapreduce.Job.submit(Job.java:1304)
at hadoop.utils.HadoopUtils.waitForCompletion(HadoopUtils.java:90)
at MapreduceCodeWorkJob.run(MapreduceCodeWorkJob.java:56)
at org.apache.hadoop.util.ToolRunner.run(ToolRunner.java:70)
at org.apache.hadoop.util.ToolRunner.run(ToolRunner.java:84)
at MapreduceCodeWorkJob.main(MapreduceCodeWorkJob.java:35)
Caused by: java.lang.InstantiationException
at sun.reflect.InstantiationExceptionConstructorAccessorImpl.newInstance(InstantiationExceptionConstructorAccessorImpl.java:48)
at java.lang.reflect.Constructor.newInstance(Constructor.java:422)
at org.apache.hadoop.util.ReflectionUtils.newInstance(ReflectionUtils.java:129)

二、原因

实例化异常,原因一般是通过反射实例化对象时失败,大多原因是在于没有空参构造器,但本次错误为用错了类:

在配置reduce输出时:设置job.setOutputFormatClass(FileOutputFormat.class);

将其改为:

job.setOutputFormatClass(TextOutputFormat.class);

就没有报错了。

 

参考:

https://www.cnblogs.com/yangxusun9/p/12358399.html

mapreduce报错java.lang.InstantiationException

标签:bin   log   logs   cti   mapreduce   map   spec   tor   red   

原文地址:https://www.cnblogs.com/Lee-yl/p/13344801.html


评论


亲,登录后才可以留言!