Error while executing hadoop-mapreduce-examples-2.

2019-09-01 12:40发布

问题:

Being a beginner to hadoop,I started to try out configuring a single node hadoop cluster in ubuntu. After installation and configuration, I worked with the example part with hadoop and it have thrown the following error

hduser1@ubuntu:/usr/local/hadoop$ hadoop jar ./share/hadoop/mapreduce/hadoop-mapreduce-   examples-2.2.0.jar pi 2 5
java.lang.NoSuchMethodError: org.apache.hadoop.util.ProgramDriver.run([Ljava/lang/String;)I
    at org.apache.hadoop.examples.ExampleDriver.main(ExampleDriver.java:74)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:606)
    at org.apache.hadoop.util.RunJar.main(RunJar.java:156)

I have used Java-7-oracle and Ubuntu 12.04 and followed this post to install and configure hadoop: http://codesfusion.blogspot.in/2013/10/setup-hadoop-2x-220-on-ubuntu.html

回答1:

The error message means that while the runtime was able to find the class ProgramDriver, the function run() is not present.

The most likely reason for this is that you're running an old version of Hadoop that exposed a difference interface in ProgramDriver. About a year ago this method was renamed to run() after being called driver().

The fix for that would be making sure you're running a recent version of Hadoop.