mapreduce java.lang.Exception: java.lang.RuntimeException: java.lang.NoSuchMethodException

执行reduce的时候出现如下错误:

java.lang.Exception: java.lang.RuntimeException: java.lang.NoSuchMethodException: org.cy.pack1.MR1_Normalization$Reduce_Normalization.()
    at org.apache.hadoop.mapred.LocalJobRunner$Job.runTasks(LocalJobRunner.java:462)
    at org.apache.hadoop.mapred.LocalJobRunner$Job.run(LocalJobRunner.java:529)
Caused by: java.lang.RuntimeException: java.lang.NoSuchMethodException: org.cy.pack1.MR1_Normalization$Reduce_Normalization.()
    at org.apache.hadoop.util.ReflectionUtils.newInstance(ReflectionUtils.java:131)
    at org.apache.hadoop.mapred.ReduceTask.runNewReducer(ReduceTask.java:611)
    at org.apache.hadoop.mapred.ReduceTask.run(ReduceTask.java:389)
    at org.apache.hadoop.mapred.LocalJobRunner$Job$ReduceTaskRunnable.run(LocalJobRunner.java:319)
    at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:471)
    at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:334)
    at java.util.concurrent.FutureTask.run(FutureTask.java:166)
    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
    at java.lang.Thread.run(Thread.java:724)
Caused by: java.lang.NoSuchMethodException: org.cy.pack1.MR1_Normalization$Reduce_Normalization.()
    at java.lang.Class.getConstructor0(Class.java:2800)
    at java.lang.Class.getDeclaredConstructor(Class.java:2043)
    at org.apache.hadoop.util.ReflectionUtils.newInstance(ReflectionUtils.java:125)
    ... 9 more



原因: 没有在reduce类前面添加static关键字,因为在main函数中是按照类名调用方法的,所以要将reduce内部类声明为静态的.

你可能感兴趣的:(hadoop)