AnsweredAssumed Answered

HBase connection problem from code

Question asked by iarch on Mar 13, 2012
Latest reply on Mar 14, 2012 by yufeldman
Hi,
When try to connect to HBase from Java client, I got the following error. Google returns no useful result. Hope somebody can help here. I have MapR M3 installed with HBase.
No issue to access HBase using hbase shell.

Thanks.

============================================================================
12/03/13 14:28:25 INFO fs.JobTrackerWatcher: Current running JobTracker is: 158.187.177.73:9001
12/03/13 14:31:09 ERROR mapreduce.TableInputFormat: org.apache.hadoop.hbase.ZooKeeperConnectionException: HBase is able to connect t      ZooKeeper but the connection closes immediately. This could be a sign that the server has too many connections (30 is the default).       nsider inspecting your ZK server logs for that error and then make sure you are reusing HBaseConfiguration as often as you can. See       able's javadoc for more information.
        at org.apache.hadoop.hbase.zookeeper.ZooKeeperWatcher.<init>(ZooKeeperWatcher.java:155)
        at org.apache.hadoop.hbase.client.HConnectionManager$HConnectionImplementation.getZooKeeperWatcher(HConnectionManager.java:1      2)
        at org.apache.hadoop.hbase.client.HConnectionManager$HConnectionImplementation.setupZookeeperTrackers(HConnectionManager.jav      304)
        at org.apache.hadoop.hbase.client.HConnectionManager$HConnectionImplementation.<init>(HConnectionManager.java:295)
        at org.apache.hadoop.hbase.client.HConnectionManager.getConnection(HConnectionManager.java:157)
        at org.apache.hadoop.hbase.client.HTable.<init>(HTable.java:169)
        at org.apache.hadoop.hbase.client.HTable.<init>(HTable.java:147)
        at org.apache.hadoop.hbase.mapreduce.TableInputFormat.setConf(TableInputFormat.java:91)
        at org.apache.hadoop.util.ReflectionUtils.setConf(ReflectionUtils.java:62)
        at org.apache.hadoop.util.ReflectionUtils.newInstance(ReflectionUtils.java:117)
        at org.apache.hadoop.mapred.JobClient.writeNewSplits(JobClient.java:975)
        at org.apache.hadoop.mapred.JobClient.writeSplits(JobClient.java:995)
        at org.apache.hadoop.mapred.JobClient.access$500(JobClient.java:170)
        at org.apache.hadoop.mapred.JobClient$2.run(JobClient.java:914)
        at org.apache.hadoop.mapred.JobClient$2.run(JobClient.java:867)
        at java.security.AccessController.doPrivileged(Native Method)
        at javax.security.auth.Subject.doAs(Subject.java:396)
        at org.apache.hadoop.security.UserGroupInformation.doAs(UserGroupInformation.java:1109)
        at org.apache.hadoop.mapred.JobClient.submitJobInternal(JobClient.java:867)
        at org.apache.hadoop.mapreduce.Job.submit(Job.java:476)
        at org.apache.hadoop.mapreduce.Job.waitForCompletion(Job.java:506)
        at RowCounter.main(RowCounter.java:92)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
        at java.lang.reflect.Method.invoke(Method.java:597)
        at org.apache.hadoop.util.RunJar.main(RunJar.java:186)
Caused by: org.apache.zookeeper.KeeperException$ConnectionLossException: KeeperErrorCode = ConnectionLoss for /hbase
        at org.apache.zookeeper.KeeperException.create(KeeperException.java:90)
        at org.apache.zookeeper.KeeperException.create(KeeperException.java:42)
        at org.apache.zookeeper.ZooKeeper.exists(ZooKeeper.java:809)
        at org.apache.zookeeper.ZooKeeper.exists(ZooKeeper.java:837)
        at org.apache.hadoop.hbase.zookeeper.ZKUtil.createAndFailSilent(ZKUtil.java:903)
        at org.apache.hadoop.hbase.zookeeper.ZooKeeperWatcher.<init>(ZooKeeperWatcher.java:133)
        ... 26 more

12/03/13 14:31:09 INFO mapred.JobClient: Cleaning up the staging area maprfs://158.187.177.73:7222/var/mapr/cluster/mapred/jobTracke      staging/johnd/.staging/job_201203131427_0001
Exception in thread "main" java.io.IOException: No table was provided.
        at org.apache.hadoop.hbase.mapreduce.TableInputFormatBase.getSplits(TableInputFormatBase.java:130)
        at org.apache.hadoop.mapred.JobClient.writeNewSplits(JobClient.java:978)
        at org.apache.hadoop.mapred.JobClient.writeSplits(JobClient.java:995)
        at org.apache.hadoop.mapred.JobClient.access$500(JobClient.java:170)
        at org.apache.hadoop.mapred.JobClient$2.run(JobClient.java:914)
        at org.apache.hadoop.mapred.JobClient$2.run(JobClient.java:867)
        at java.security.AccessController.doPrivileged(Native Method)
        at javax.security.auth.Subject.doAs(Subject.java:396)
        at org.apache.hadoop.security.UserGroupInformation.doAs(UserGroupInformation.java:1109)
        at org.apache.hadoop.mapred.JobClient.submitJobInternal(JobClient.java:867)
        at org.apache.hadoop.mapreduce.Job.submit(Job.java:476)
        at org.apache.hadoop.mapreduce.Job.waitForCompletion(Job.java:506)
        at RowCounter.main(RowCounter.java:92)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
        at java.lang.reflect.Method.invoke(Method.java:597)
        at org.apache.hadoop.util.RunJar.main(RunJar.java:186)

Outcomes