Wednesday, December 26, 2012

Apache Hbase unit test error

Building and testing Hbase 0.94.3 in Linux (RedHat and Sles) I came across with a error a couple of times, and solved it with 3 different approaches that I think might be good to share.
Several testcases were failing due to it, such as TestCatalogTrackerOnCluster and TestLogRollAbort.

I ran  mvn clean compile package, and got the following error:



java.io.IOException: Shutting down
 at org.apache.hadoop.hbase.MiniHBaseCluster.init(MiniHBaseCluster.java:203)
 at org.apache.hadoop.hbase.MiniHBaseCluster.<init>(MiniHBaseCluster.java:76)
 at org.apache.hadoop.hbase.HBaseTestingUtility.startMiniHBaseCluster(HBaseTestingUtility.java:632)
 at org.apache.hadoop.hbase.HBaseTestingUtility.startMiniCluster(HBaseTestingUtility.java:606)
 at org.apache.hadoop.hbase.HBaseTestingUtility.startMiniCluster(HBaseTestingUtility.java:554)
 at org.apache.hadoop.hbase.HBaseTestingUtility.startMiniCluster(HBaseTestingUtility.java:541)
 at org.apache.giraffa.TestRestartGiraffa.beforeClass(TestRestartGiraffa.java:39)
Caused by: java.lang.RuntimeException: Master not initialized after 200 seconds
 at org.apache.hadoop.hbase.util.JVMClusterUtil.startup(JVMClusterUtil.java:206)
 at org.apache.hadoop.hbase.LocalHBaseCluster.startup(LocalHBaseCluster.java:420)
 at org.apache.hadoop.hbase.MiniHBaseCluster.init(MiniHBaseCluster.java:196)



The first thing you should do is run the following command:

 $ umask 0022

Next, make sure your JVM has enough memory to work with:

 $ export MAVEN_OPTS="-Xmx512m"

Finally, it might me possible that this error is being caused by different loopback addresses in the /etc/hosts file.
Open the /etc/hosts and check if you have different loopback address such as 127.0.0.1 and 127.0.0.2. If so, change both to 127.0.0.1, so they are the same.