Hadoop: The Definitive Guide (3rd Ed) error with MaxTemperature example
In the book Hadoop: The Definitive Guide (3rd Ed), there is an error in Chapter 2 MapReduce (the error is also in the ePub and PDF versions). The book shows setting HADOOP_CLASSPATH=hadoop-examples.jar, however this JAR file does not exist. The Ant build.xml creates a job.jar file which contains all of the examples included in the book. Setting HADOOP_CLASSPATH=job.jar fixes this problem and allows the example to work properly.
The error you will get if you have the HADOOP_CLASSPATH set incorrectly (as specified in the book) will be:
[root@hadoop01 hadoop-book]# hadoop MaxTemperature input/ncdc/sample.txt output
Exception in thread “main” java.lang.NoClassDefFoundError: MaxTemperature
Caused by: java.lang.ClassNotFoundException: MaxTemperature
at java.security.AccessController.doPrivileged(Native Method)
Could not find the main class: MaxTemperature. Program will exit.
I have submitted this correction to be included in the Errata and hopefully it will be reflected on the books website soon.
This entry was posted in Data Analytics
. Bookmark the permalink