<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>question HBase - Using Java API to put data into Table gives error in Archives of Support Questions (Read Only)</title>
    <link>https://community.cloudera.com/t5/Archives-of-Support-Questions/HBase-Using-Java-API-to-put-data-into-Table-gives-error/m-p/160517#M49272</link>
    <description>&lt;P&gt;Hi All,&lt;/P&gt;&lt;P&gt;I've HDP 2.4 &amp;amp; i'm trying to put data into HBase table using Java API,
it gives error shown below, &lt;/P&gt;&lt;P&gt;Any ideas pls let me know.
Code used to add data to the HBase table (java file attached) -&amp;gt;
&lt;A href="https://community.cloudera.com/legacyfs/online/attachments/10395-accessobjectjava.txt"&gt;accessobjectjava.txt&lt;/A&gt;
   public Put mkPut(User u){
     Put p = new Put(Bytes.toBytes(u.user)); 
     p.add(INFO_FAMILY, USER_COL, Bytes.toBytes(u.user));
     p.add(INFO_FAMILY, NAME_COL, Bytes.toBytes(u.name));
     p.add(INFO_FAMILY, EMAIL_COL, Bytes.toBytes(u.email));
     return p;
   }&lt;/P&gt;&lt;P&gt;public void addUser(String user, String name, String email) throws IOException{
     HTableInterface users = connection.getTable(TABLE_NAME);
     Put p = mkPut(new User(user,name,email));   
     users.put(p);
     users.close();
   }
     
---------------------------------ERROR ON CONSOLE--------------------------------------------------------&lt;/P&gt;&lt;P&gt;[root@sandbox ~]# java hbase/Exercise2/HBaseTester add kim123 kim kim@gmail.com
log4j:WARN No appenders could be found for logger (org.apache.hadoop.util.Shell).
log4j:WARN Please initialize the log4j system properly.
log4j:WARN See &lt;A href="http://logging.apache.org/log4j/1.2/faq.html#noconfig" target="_blank"&gt;http://logging.apache.org/log4j/1.2/faq.html#noconfig&lt;/A&gt; for more info.
Adding user...
 in add user
 in add user, users users;hconnection-0x43cdebe p {"totalColumns":3,"families":{"info":[{"timestamp":9223372036854775807,"tag":[],"qualifier":"user","vlen":6},{"timestamp":9223372036854775807,"tag":[],"qualifier":"name","vlen":3},{"timestamp":9223372036854775807,"tag":[],"qualifier":"email","vlen":13}]},"row":"kim123"}
java.lang.RuntimeException: java.lang.NullPointerException
   at org.apache.hadoop.hbase.client.RpcRetryingCaller.callWithoutRetries(RpcRetryingCaller.java:208)
   at org.apache.hadoop.hbase.client.ClientSmallReversedScanner.loadCache(ClientSmallReversedScanner.java:211)
   at org.apache.hadoop.hbase.client.ClientSmallReversedScanner.next(ClientSmallReversedScanner.java:185)
   at org.apache.hadoop.hbase.client.ConnectionManager$HConnectionImplementation.locateRegionInMeta(ConnectionManager.java:1256)
   at org.apache.hadoop.hbase.client.ConnectionManager$HConnectionImplementation.locateRegion(ConnectionManager.java:1162)
   at org.apache.hadoop.hbase.client.AsyncProcess.submit(AsyncProcess.java:370)
   at org.apache.hadoop.hbase.client.AsyncProcess.submit(AsyncProcess.java:321)
   at org.apache.hadoop.hbase.client.BufferedMutatorImpl.backgroundFlushCommits(BufferedMutatorImpl.java:206)
   at org.apache.hadoop.hbase.client.BufferedMutatorImpl.flush(BufferedMutatorImpl.java:183)
   at org.apache.hadoop.hbase.client.HTable.flushCommits(HTable.java:1449)
   at org.apache.hadoop.hbase.client.HTable.put(HTable.java:1040)
   at hbase.Exercise2.AccessObject.addUser(AccessObject.java:93)
   at hbase.Exercise2.HBaseTester.main(HBaseTester.java:27)
Caused by: java.lang.NullPointerException
   at org.apache.hadoop.hbase.zookeeper.ZooKeeperWatcher.getMetaReplicaNodes(ZooKeeperWatcher.java:399)
   at org.apache.hadoop.hbase.zookeeper.MetaTableLocator.blockUntilAvailable(MetaTableLocator.java:552)
   at org.apache.hadoop.hbase.client.ZooKeeperRegistry.getMetaRegionLocation(ZooKeeperRegistry.java:61)
   at org.apache.hadoop.hbase.client.ConnectionManager$HConnectionImplementation.locateMeta(ConnectionManager.java:1192)
   at org.apache.hadoop.hbase.client.ConnectionManager$HConnectionImplementation.locateRegion(ConnectionManager.java:1159)
   at org.apache.hadoop.hbase.client.RpcRetryingCallerWithReadReplicas.getRegionLocations(RpcRetryingCallerWithReadReplicas.java:300)
   at org.apache.hadoop.hbase.client.ScannerCallableWithReplicas.call(ScannerCallableWithReplicas.java:151)
   at org.apache.hadoop.hbase.client.ScannerCallableWithReplicas.call(ScannerCallableWithReplicas.java:59)
   at org.apache.hadoop.hbase.client.RpcRetryingCaller.callWithoutRetries(RpcRetryingCaller.java:200)
   ... 12 more
Exception in thread "main" java.lang.RuntimeException: java.lang.NullPointerException
   at org.apache.hadoop.hbase.client.RpcRetryingCaller.callWithoutRetries(RpcRetryingCaller.java:208)
   at org.apache.hadoop.hbase.client.ClientSmallReversedScanner.loadCache(ClientSmallReversedScanner.java:211)
   at org.apache.hadoop.hbase.client.ClientSmallReversedScanner.next(ClientSmallReversedScanner.java:185)
   at org.apache.hadoop.hbase.client.ConnectionManager$HConnectionImplementation.locateRegionInMeta(ConnectionManager.java:1256)
   at org.apache.hadoop.hbase.client.ConnectionManager$HConnectionImplementation.locateRegion(ConnectionManager.java:1162)
   at org.apache.hadoop.hbase.client.AsyncProcess.submit(AsyncProcess.java:370)
   at org.apache.hadoop.hbase.client.AsyncProcess.submit(AsyncProcess.java:321)
   at org.apache.hadoop.hbase.client.BufferedMutatorImpl.backgroundFlushCommits(BufferedMutatorImpl.java:206)
   at org.apache.hadoop.hbase.client.BufferedMutatorImpl.flush(BufferedMutatorImpl.java:183)
   at org.apache.hadoop.hbase.client.HTable.flushCommits(HTable.java:1449)
   at org.apache.hadoop.hbase.client.HTable.close(HTable.java:1485)
   at hbase.Exercise2.AccessObject.addUser(AccessObject.java:98)
   at hbase.Exercise2.HBaseTester.main(HBaseTester.java:27)
Caused by: java.lang.NullPointerException
   at org.apache.hadoop.hbase.zookeeper.ZooKeeperWatcher.getMetaReplicaNodes(ZooKeeperWatcher.java:399)
   at org.apache.hadoop.hbase.zookeeper.MetaTableLocator.blockUntilAvailable(MetaTableLocator.java:552)
   at org.apache.hadoop.hbase.client.ZooKeeperRegistry.getMetaRegionLocation(ZooKeeperRegistry.java:61)
   at org.apache.hadoop.hbase.client.ConnectionManager$HConnectionImplementation.locateMeta(ConnectionManager.java:1192)
   at org.apache.hadoop.hbase.client.ConnectionManager$HConnectionImplementation.locateRegion(ConnectionManager.java:1159)
   at org.apache.hadoop.hbase.client.RpcRetryingCallerWithReadReplicas.getRegionLocations(RpcRetryingCallerWithReadReplicas.java:300)
   at org.apache.hadoop.hbase.client.ScannerCallableWithReplicas.call(ScannerCallableWithReplicas.java:151)
   at org.apache.hadoop.hbase.client.ScannerCallableWithReplicas.call(ScannerCallableWithReplicas.java:59)
   at org.apache.hadoop.hbase.client.RpcRetryingCaller.callWithoutRetries(RpcRetryingCaller.java:200)
   ... 12 more&lt;/P&gt;</description>
    <pubDate>Mon, 19 Dec 2016 02:22:59 GMT</pubDate>
    <dc:creator>karan_alang1</dc:creator>
    <dc:date>2016-12-19T02:22:59Z</dc:date>
    <item>
      <title>HBase - Using Java API to put data into Table gives error</title>
      <link>https://community.cloudera.com/t5/Archives-of-Support-Questions/HBase-Using-Java-API-to-put-data-into-Table-gives-error/m-p/160517#M49272</link>
      <description>&lt;P&gt;Hi All,&lt;/P&gt;&lt;P&gt;I've HDP 2.4 &amp;amp; i'm trying to put data into HBase table using Java API,
it gives error shown below, &lt;/P&gt;&lt;P&gt;Any ideas pls let me know.
Code used to add data to the HBase table (java file attached) -&amp;gt;
&lt;A href="https://community.cloudera.com/legacyfs/online/attachments/10395-accessobjectjava.txt"&gt;accessobjectjava.txt&lt;/A&gt;
   public Put mkPut(User u){
     Put p = new Put(Bytes.toBytes(u.user)); 
     p.add(INFO_FAMILY, USER_COL, Bytes.toBytes(u.user));
     p.add(INFO_FAMILY, NAME_COL, Bytes.toBytes(u.name));
     p.add(INFO_FAMILY, EMAIL_COL, Bytes.toBytes(u.email));
     return p;
   }&lt;/P&gt;&lt;P&gt;public void addUser(String user, String name, String email) throws IOException{
     HTableInterface users = connection.getTable(TABLE_NAME);
     Put p = mkPut(new User(user,name,email));   
     users.put(p);
     users.close();
   }
     
---------------------------------ERROR ON CONSOLE--------------------------------------------------------&lt;/P&gt;&lt;P&gt;[root@sandbox ~]# java hbase/Exercise2/HBaseTester add kim123 kim kim@gmail.com
log4j:WARN No appenders could be found for logger (org.apache.hadoop.util.Shell).
log4j:WARN Please initialize the log4j system properly.
log4j:WARN See &lt;A href="http://logging.apache.org/log4j/1.2/faq.html#noconfig" target="_blank"&gt;http://logging.apache.org/log4j/1.2/faq.html#noconfig&lt;/A&gt; for more info.
Adding user...
 in add user
 in add user, users users;hconnection-0x43cdebe p {"totalColumns":3,"families":{"info":[{"timestamp":9223372036854775807,"tag":[],"qualifier":"user","vlen":6},{"timestamp":9223372036854775807,"tag":[],"qualifier":"name","vlen":3},{"timestamp":9223372036854775807,"tag":[],"qualifier":"email","vlen":13}]},"row":"kim123"}
java.lang.RuntimeException: java.lang.NullPointerException
   at org.apache.hadoop.hbase.client.RpcRetryingCaller.callWithoutRetries(RpcRetryingCaller.java:208)
   at org.apache.hadoop.hbase.client.ClientSmallReversedScanner.loadCache(ClientSmallReversedScanner.java:211)
   at org.apache.hadoop.hbase.client.ClientSmallReversedScanner.next(ClientSmallReversedScanner.java:185)
   at org.apache.hadoop.hbase.client.ConnectionManager$HConnectionImplementation.locateRegionInMeta(ConnectionManager.java:1256)
   at org.apache.hadoop.hbase.client.ConnectionManager$HConnectionImplementation.locateRegion(ConnectionManager.java:1162)
   at org.apache.hadoop.hbase.client.AsyncProcess.submit(AsyncProcess.java:370)
   at org.apache.hadoop.hbase.client.AsyncProcess.submit(AsyncProcess.java:321)
   at org.apache.hadoop.hbase.client.BufferedMutatorImpl.backgroundFlushCommits(BufferedMutatorImpl.java:206)
   at org.apache.hadoop.hbase.client.BufferedMutatorImpl.flush(BufferedMutatorImpl.java:183)
   at org.apache.hadoop.hbase.client.HTable.flushCommits(HTable.java:1449)
   at org.apache.hadoop.hbase.client.HTable.put(HTable.java:1040)
   at hbase.Exercise2.AccessObject.addUser(AccessObject.java:93)
   at hbase.Exercise2.HBaseTester.main(HBaseTester.java:27)
Caused by: java.lang.NullPointerException
   at org.apache.hadoop.hbase.zookeeper.ZooKeeperWatcher.getMetaReplicaNodes(ZooKeeperWatcher.java:399)
   at org.apache.hadoop.hbase.zookeeper.MetaTableLocator.blockUntilAvailable(MetaTableLocator.java:552)
   at org.apache.hadoop.hbase.client.ZooKeeperRegistry.getMetaRegionLocation(ZooKeeperRegistry.java:61)
   at org.apache.hadoop.hbase.client.ConnectionManager$HConnectionImplementation.locateMeta(ConnectionManager.java:1192)
   at org.apache.hadoop.hbase.client.ConnectionManager$HConnectionImplementation.locateRegion(ConnectionManager.java:1159)
   at org.apache.hadoop.hbase.client.RpcRetryingCallerWithReadReplicas.getRegionLocations(RpcRetryingCallerWithReadReplicas.java:300)
   at org.apache.hadoop.hbase.client.ScannerCallableWithReplicas.call(ScannerCallableWithReplicas.java:151)
   at org.apache.hadoop.hbase.client.ScannerCallableWithReplicas.call(ScannerCallableWithReplicas.java:59)
   at org.apache.hadoop.hbase.client.RpcRetryingCaller.callWithoutRetries(RpcRetryingCaller.java:200)
   ... 12 more
Exception in thread "main" java.lang.RuntimeException: java.lang.NullPointerException
   at org.apache.hadoop.hbase.client.RpcRetryingCaller.callWithoutRetries(RpcRetryingCaller.java:208)
   at org.apache.hadoop.hbase.client.ClientSmallReversedScanner.loadCache(ClientSmallReversedScanner.java:211)
   at org.apache.hadoop.hbase.client.ClientSmallReversedScanner.next(ClientSmallReversedScanner.java:185)
   at org.apache.hadoop.hbase.client.ConnectionManager$HConnectionImplementation.locateRegionInMeta(ConnectionManager.java:1256)
   at org.apache.hadoop.hbase.client.ConnectionManager$HConnectionImplementation.locateRegion(ConnectionManager.java:1162)
   at org.apache.hadoop.hbase.client.AsyncProcess.submit(AsyncProcess.java:370)
   at org.apache.hadoop.hbase.client.AsyncProcess.submit(AsyncProcess.java:321)
   at org.apache.hadoop.hbase.client.BufferedMutatorImpl.backgroundFlushCommits(BufferedMutatorImpl.java:206)
   at org.apache.hadoop.hbase.client.BufferedMutatorImpl.flush(BufferedMutatorImpl.java:183)
   at org.apache.hadoop.hbase.client.HTable.flushCommits(HTable.java:1449)
   at org.apache.hadoop.hbase.client.HTable.close(HTable.java:1485)
   at hbase.Exercise2.AccessObject.addUser(AccessObject.java:98)
   at hbase.Exercise2.HBaseTester.main(HBaseTester.java:27)
Caused by: java.lang.NullPointerException
   at org.apache.hadoop.hbase.zookeeper.ZooKeeperWatcher.getMetaReplicaNodes(ZooKeeperWatcher.java:399)
   at org.apache.hadoop.hbase.zookeeper.MetaTableLocator.blockUntilAvailable(MetaTableLocator.java:552)
   at org.apache.hadoop.hbase.client.ZooKeeperRegistry.getMetaRegionLocation(ZooKeeperRegistry.java:61)
   at org.apache.hadoop.hbase.client.ConnectionManager$HConnectionImplementation.locateMeta(ConnectionManager.java:1192)
   at org.apache.hadoop.hbase.client.ConnectionManager$HConnectionImplementation.locateRegion(ConnectionManager.java:1159)
   at org.apache.hadoop.hbase.client.RpcRetryingCallerWithReadReplicas.getRegionLocations(RpcRetryingCallerWithReadReplicas.java:300)
   at org.apache.hadoop.hbase.client.ScannerCallableWithReplicas.call(ScannerCallableWithReplicas.java:151)
   at org.apache.hadoop.hbase.client.ScannerCallableWithReplicas.call(ScannerCallableWithReplicas.java:59)
   at org.apache.hadoop.hbase.client.RpcRetryingCaller.callWithoutRetries(RpcRetryingCaller.java:200)
   ... 12 more&lt;/P&gt;</description>
      <pubDate>Mon, 19 Dec 2016 02:22:59 GMT</pubDate>
      <guid>https://community.cloudera.com/t5/Archives-of-Support-Questions/HBase-Using-Java-API-to-put-data-into-Table-gives-error/m-p/160517#M49272</guid>
      <dc:creator>karan_alang1</dc:creator>
      <dc:date>2016-12-19T02:22:59Z</dc:date>
    </item>
    <item>
      <title>Re: HBase - Using Java API to put data into Table gives error</title>
      <link>https://community.cloudera.com/t5/Archives-of-Support-Questions/HBase-Using-Java-API-to-put-data-into-Table-gives-error/m-p/160518#M49273</link>
      <description>&lt;P&gt;after looking at the attached program it seems that you are not initializing the configuration object properly. you need to do something like this to create configuration object&lt;/P&gt;&lt;P&gt;Configuration conf =HBaseConfiguration.create();&lt;/P&gt;&lt;P&gt;conf.set("hbase.zookeeper.property.clientPort","2181");&lt;/P&gt;&lt;P&gt;conf.set("hbase.zookeeper.quorum","&amp;lt;hostname&amp;gt;");&lt;/P&gt;&lt;P&gt;conf.set("zookeeper.znode.parent","/hbase");&lt;/P&gt;&lt;P&gt;please refer this to create connection object&lt;/P&gt;&lt;P&gt;&lt;A href="https://community.hortonworks.com/articles/2038/how-to-connect-to-hbase-11-using-java-apis.html" target="_blank"&gt;https://community.hortonworks.com/articles/2038/how-to-connect-to-hbase-11-using-java-apis.html&lt;/A&gt;&lt;/P&gt;</description>
      <pubDate>Mon, 19 Dec 2016 02:29:13 GMT</pubDate>
      <guid>https://community.cloudera.com/t5/Archives-of-Support-Questions/HBase-Using-Java-API-to-put-data-into-Table-gives-error/m-p/160518#M49273</guid>
      <dc:creator>rajkumar_singh</dc:creator>
      <dc:date>2016-12-19T02:29:13Z</dc:date>
    </item>
    <item>
      <title>Re: HBase - Using Java API to put data into Table gives error</title>
      <link>https://community.cloudera.com/t5/Archives-of-Support-Questions/HBase-Using-Java-API-to-put-data-into-Table-gives-error/m-p/160519#M49274</link>
      <description>&lt;P&gt;&lt;A rel="user" href="https://community.cloudera.com/users/8919/rajkumarsingh.html" nodeid="8919"&gt;@Rajkumar Singh&lt;/A&gt; - thanks, that worked fine !&lt;/P&gt;</description>
      <pubDate>Mon, 19 Dec 2016 03:07:03 GMT</pubDate>
      <guid>https://community.cloudera.com/t5/Archives-of-Support-Questions/HBase-Using-Java-API-to-put-data-into-Table-gives-error/m-p/160519#M49274</guid>
      <dc:creator>karan_alang1</dc:creator>
      <dc:date>2016-12-19T03:07:03Z</dc:date>
    </item>
  </channel>
</rss>

