java.lang.RuntimeException: java.lang.NoSuchMethodException:

[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

posted on 2015-12-19 14:19  IT小不点  阅读(3452)  评论(0编辑  收藏  举报