I recently started working through Hadoop: The Definitive Guide (3rd Ed) by Tom White. One of the things you need to do is compile all the source files and examples that come with the book. This is done via an ant build.xml. One of those targets is for hbase, and it fails like so:
[root@hadoop01 hadoop-book]# ant hbase
Buildfile: build.xml
init:
retrieve-dependencies:
[ivy:retrieve] :: Apache Ivy 2.3.0-rc1 – 20120416000235 :: http://ant.apache.org/ivy/ ::
[ivy:retrieve] :: loading settings :: url = jar:file:/usr/share/ant/lib/ivy.jar!/org/apache/ivy/core/settings/ivysettings.xml
hbase.compile:
[javac] Compiling 5 source files to /root/hadoop-book/build/classes
[javac] /root/hadoop-book/ch13/src/main/java/HBaseStationCli.java:23: addColumn(byte[],byte[]) in org.apache.hadoop.hbase.client.Get cannot be applied to (byte[])
[javac] get.addColumn(INFO_COLUMNFAMILY);
[javac] ^
[javac] Note: Some input files use or override a deprecated API.
[javac] Note: Recompile with -Xlint:deprecation for details.
[javac] 1 error
BUILD FAILED
/root/hadoop-book/build.xml:126: Compile failed; see the compiler error output for details.
Total time: 2 seconds
The issue appears to be documented in an Unconfirmed Errata for the book:
http://oreilly.com/catalog/errataunconfirmed.csp?isbn=0636920010388
However, there is no fix, and no information on how to resolve this available online.
The issue appears to be with this line, from ch13/src/main/java/HBaseStationCli.java:
get.addColumn(INFO_COLUMNFAMILY);
The method addColumn from the class org.apache.hadoop.hbase.client.Get is documented here:
http://hbase.apache.org/apidocs/org/apache/hadoop/hbase/client/Get.html
You can see that this method expects two parameters of type byte[], a family name and a column qualifier:
1 |
<span style="font-family: 'courier new', courier;">public <a title="class in org.apache.hadoop.hbase.client" href="http://hbase.apache.org/apidocs/org/apache/hadoop/hbase/client/Get.html">Get</a> <strong>addColumn</strong>(byte[] family, byte[] qualifier)</span> |
1 |
<span style="font-family: 'courier new', courier;">public <a title="class in org.apache.hadoop.hbase.client" href="http://hbase.apache.org/apidocs/org/apache/hadoop/hbase/client/Get.html">Get</a> <strong>addFamily</strong>(byte[] family)</span> |
Please let me know if this has been helpful and if you have any thoughts on this errata. Hopefully in short order Tom White will update the problem to the confirmed errata and make the official correction.