Saturday 24 August 2013

How to make sure HBase Java client is using the hbase-site.xml

How to make sure HBase Java client is using the hbase-site.xml

Versions: Hadoop: 2.0.0-cdh4.3.1
HBase: 0.94.6-cdh4.3.1
I am running cloudera quick start vm, Here is my little remote HBase Java
client(HbaseClient.java), all it does is:
public static void main(String[] args) throws IOException {
Configuration config = HBaseConfiguration.create();
HTable table = new HTable(config, "s1");
System.out.println(table.getTableName());
}
When I run my java client, I get this error:
log4j:WARN No appenders could be found for logger
(org.apache.hadoop.metrics2.lib.MutableMetricsFactory).
log4j:WARN Please initialize the log4j system properly.
log4j:WARN See http://logging.apache.org/log4j/1.2/faq.html#noconfig for
more info.
2013-08-25 00:01:56.684 java[39082:1703] Unable to load realm info from
SCDynamicStore
Exception in thread "main"
org.apache.hadoop.hbase.client.NoServerForRegionException: Unable to find
region for s1,,99999999999999 after 10 tries.
at
org.apache.hadoop.hbase.client.HConnectionManager$HConnectionImplementation.locateRegionInMeta(HConnectionManager.java:980)
at
org.apache.hadoop.hbase.client.HConnectionManager$HConnectionImplementation.locateRegion(HConnectionManager.java:885)
at
org.apache.hadoop.hbase.client.HConnectionManager$HConnectionImplementation.locateRegionInMeta(HConnectionManager.java:987)
at
org.apache.hadoop.hbase.client.HConnectionManager$HConnectionImplementation.locateRegion(HConnectionManager.java:889)
at
org.apache.hadoop.hbase.client.HConnectionManager$HConnectionImplementation.locateRegion(HConnectionManager.java:846)
at org.apache.hadoop.hbase.client.HTable.finishSetup(HTable.java:271)
at org.apache.hadoop.hbase.client.HTable.<init>(HTable.java:211)
at org.apache.hadoop.hbase.client.HTable.<init>(HTable.java:170)
at com.***************.api.HBaseClient.main(HBaseClient.java:24)
I debugged through the code, it's hard to find whether the client is using
my hbase-site.xml in resources folder or not. I even put wrong format
content in hbase-site.xml, Java client is getting the same error. So I
think it's not using it. Isn't resources folder part of the CLASSPATH? Is
there any way to check if the hbase-site.xml gets used, if not used, how
to get my client to use it.

No comments:

Post a Comment