The Hortonworks Community Connection is now live. A completely rebuilt Q&A forum, Knowledge Base, Code Hub and more, backed by the experts in the industry.

You will be redirected here in 10 seconds. If your are not redirected, click here to visit the new site.

The legacy Hortonworks Forum is now closed. You can view a read-only version of the former site by clicking here. The site will be taken offline on January 31,2016

HBase Forum

problem with Simple Java client on Cent OS running on HDP 2

  • #43905

    On Oracle Virtual box, created a VM and installed Cent OS and all HDP 2.0 components. When running the below simple java application, the application freezes when the code to create HTable is called. From error message, it looks like not able to find region server/region.What I am missing?
    import org.apache.hadoop.conf.Configuration;
    import org.apache.hadoop.hbase.HBaseConfiguration;
    import org.apache.hadoop.hbase.client.HTable;
    import org.apache.hadoop.hbase.client.Put;
    import org.apache.hadoop.hbase.util.Bytes;

    public class TestHbaseInsert {
    public static void main(String[] args) throws IOException {
    Configuration conf = HBaseConfiguration.create();
    HTable table = new HTable(conf, “testtable”);
    Put put = new Put(Bytes.toBytes(“row1”));
    put.add(Bytes.toBytes(“colfam1”), Bytes.toBytes(“qual1”),
    put.add(Bytes.toBytes(“colfam1”), Bytes.toBytes(“qual2”),
    /usr/java/default/bin/java -agentlib:jdwp=transport=dt_socket,address=,suspend=y,server=n -Dfile.encoding=UTF-8 -classpath
    0x307b4703 connecting to ZooKeeper ensemble=localhost:2181
    2013-11-17 22:55:12,761 INFO [main-SendThread(] zookeeper.ClientCnxn ( – Opening socket connection to server Will not attempt to authenticate using SASL (java.lang.SecurityException: Unable to locate a login configuration)
    2013-11-17 22:55:12,777 INFO [main-SendThread(] zookeeper.ClientCnxn ( – Socket connection established to, initiating session
    2013-11-17 22:55:12,818 INFO [main-SendThread(] zookeeper.ClientCnxn ( – Session establishment complete on server, sessionid = 0x14269f4f96b001a, negotiated timeout = 40000
    2013-11-17 22:55:12,838 INFO [main] client.ZooKeeperRegistry ( – ClusterId read in ZooKeeper is null

    Exception in thread “main” org.apache.hadoop.hbase.client.NoServerForRegionException: Unable to find region for after 35 tries.
    at org.apache.hadoop.hbase.client.HConnectionManager$HConnectionImplementation.locateRegionInMeta(
    at org.apache.hadoop.hbase.client.HConnectionManager$HConnectionImplementation.locateRegion(
    at org.apache.hadoop.hbase.client.HConnectionManager$HConnectionImplementation.locateRegion(
    at org.apache.hadoop.hbase.client.HTable.finishSetup(
    at org.apache.hadoop.hbase.client.HTable.(
    at org.apache.hadoop.hbase.client.HTable.(
    Disconnected from the target VM, address: ‘’, transport: ‘socket’
    Process finished with exit code

  • Author
  • #44014
    Jeffrey Zhong

    Have you created testtable table already before you run the above client code? If you already created the table, please paste your table definition here using describe command in hbase shell.



    Thanks for helping me with this.
    hbase(main):003:0> describe ‘testtable’
    ‘testtable’, {NAME => ‘colfam1’, DATA_BLOCK_ENCODIN true
    E => ‘0’, VERSIONS => ‘1’, COMPRESSION => ‘NONE’, M
    IN_VERSIONS => ‘0’, TTL => ‘2147483647’, KEEP_DELET
    ED_CELLS => ‘false’, BLOCKSIZE => ‘65536’, IN_MEMOR
    Y => ‘false’, ENCODE_ON_DISK => ‘true’, BLOCKCACHE
    => ‘true’}
    1 row(s) in 0.9150 seconds

    Enis Soztutar

    The problem might be that you do not have Hbase configuration files in your classpath. Your application should have /etc/hbase/conf as a part of the classpath, so that Hbase can read the hbase-site.xml and other configuration files from there.

    Jeffrey Zhong

    I tried your script and it runs fine.

    It seems your Region Server wasn’t running. Could you please enable the debug log by setting log4j.rootLogger=INFO,RFA from “log4j.rootLogger=${hbase.root.logger}” in file /usr/lib/hbase/conf/

    After configuration change, you need to restart HBase using hbase user:

    1) [hbase@sandbox ~]$ cd /usr/lib/hbase

    ./bin/ stop regionserver
    ./bin/ stop master
    ./bin/ start master
    ./bin/ start regionserver

    3) use hbase shell to send some sample puts to testtable. If it’s good, then try your sample client code

    The java command I’m using is:

    java -cp `hbase classpath` TestHbaseInsert

    Jeffrey Zhong

    There is a some typo, log4j.rootLogger=INFO,RFA should be as following:


The forum ‘HBase’ is closed to new topics and replies.

Support from the Experts

A HDP Support Subscription connects you experts with deep experience running Apache Hadoop in production, at-scale on the most demanding workloads.

Enterprise Support »

Become HDP Certified

Real world training designed by the core architects of Hadoop. Scenario-based training courses are available in-classroom or online from anywhere in the world

Training »

Hortonworks Data Platform
The Hortonworks Data Platform is a 100% open source distribution of Apache Hadoop that is truly enterprise grade having been built, tested and hardened with enterprise rigor.
Get started with Sandbox
Hortonworks Sandbox is a self-contained virtual machine with Apache Hadoop pre-configured alongside a set of hands-on, step-by-step Hadoop tutorials.
Modern Data Architecture
Tackle the challenges of big data. Hadoop integrates with existing EDW, RDBMS and MPP systems to deliver lower cost, higher capacity infrastructure.