[java] 15/12/19 14:09:46 INFO mapred.JobClient: Task Id : attempt_201512182036_0017_m_000000_0, Status : FAILED
[java] java.lang.RuntimeException: java.lang.NoSuchMethodException: org.lukey.hadoop.tianyi.TianYiBigData$MyMapper.<init>()
[java] at org.apache.hadoop.util.ReflectionUtils.newInstance(ReflectionUtils.java:115)
[java] at org.apache.hadoop.mapred.MapTask.runNewMapper(MapTask.java:719)
[java] at org.apache.hadoop.mapred.MapTask.run(MapTask.java:370)
[java] at org.apache.hadoop.mapred.Child$4.run(Child.java:255)
[java] at java.security.AccessController.doPrivileged(Native Method)
[java] at javax.security.auth.Subject.doAs(Subject.java:422)
[java] at org.apache.hadoop.security.UserGroupInformation.doAs(UserGroupInformation.java:1121)
[java] at org.apache.hadoop.mapred.Child.main(Child.java:249)
[java] Caused by: java.lang.NoSuchMethodException: org.lukey.hadoop.tianyi.TianYiBigData$MyMapper.<init>()
[java] at java.lang.Class.getConstructor0(Class.java:3082)
[java] at java.lang.Class.getDeclaredConstructor(Class.java:2178)
[java] at org.apache.hadoop.util.ReflectionUtils.newInstance(ReflectionUtils.java:109)
[java] ... 7 more

 

需要在MyMapper前面加static。

If the class is an inner class, make sure it's declared static (i.e. doesn't need an instance of the enclosing class). Otherwise, Hadoop cannot instantiate your inner class and will give this same error - that a zero-arg constructor is needed.

http://stackoverflow.com/questions/11446635/no-such-method-exception-hadoop-init

相关文章:

  • 2021-06-20
  • 2021-10-01
  • 2021-11-13
  • 2021-11-23
  • 2022-02-04
  • 2022-12-23
  • 2022-12-23
猜你喜欢
  • 2022-12-23
  • 2021-10-06
  • 2021-04-24
  • 2021-06-28
相关资源
相似解决方案