<?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 Java API connection error in Archives of Support Questions (Read Only)</title>
    <link>https://community.cloudera.com/t5/Archives-of-Support-Questions/Hbase-Java-API-connection-error/m-p/103732#M25441</link>
    <description>&lt;P&gt;
	Hi,&lt;/P&gt;&lt;P&gt;
	I'm trying to connect from A java Application to Hbase like this:&lt;/P&gt;
&lt;PRE&gt;Configuration config = HBaseConfiguration.create();
        config.set("hbase.zookeeper.quorum", "localhost");
        config.set("hbase.zookeeper.property.clientPort", "2181");
        config.set("zookeeper.znode.parent", "/hbase-unsecure");
        
        config.set("hbase.client.retries.number", Integer.toString(0));
        config.set("zookeeper.session.timeout", Integer.toString(60000));
        config.set("zookeeper.recovery.retry", Integer.toString(0));
        
        Connection conn = ConnectionFactory.createConnection(config);
        TableName TABLE_NAME = TableName.valueOf("weblog");
        Table table = conn.getTable(TABLE_NAME);
        Result r = table.get(new Get(Bytes.toBytes("row1")));
        System.out.println(r);
&lt;/PRE&gt;&lt;P&gt;
	I builded the App into a JAR but when running it on the cluster with :&lt;/P&gt;
&lt;PRE&gt;hadoop jar hbaseConnect-0.0.1-SNAPSHOT.jar com.packagename.hbaseConnect.HbaseConnect
&lt;/PRE&gt;&lt;P&gt;
	 i get the following error:&lt;/P&gt;
&lt;PRE&gt;Exception in thread "main" java.lang.NoClassDefFoundError: org/apache/hadoop/hbase/HBaseConfiguration
    at com.DigiMerket.hbaseConnect.HbaseConnect.main(HbaseConnect.java:23)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:497)
    at org.apache.hadoop.util.RunJar.run(RunJar.java:221)
    at org.apache.hadoop.util.RunJar.main(RunJar.java:136)
Caused by: java.lang.ClassNotFoundException: org.apache.hadoop.hbase.HBaseConfiguration
    at java.net.URLClassLoader.findClass(URLClassLoader.java:381)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:424)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:357)
    ... 7 more
&lt;/PRE&gt;&lt;P&gt;
	I tried to add HBASE_CLASSPATH to HADOOP_CLASSPATH in hadoop-env like this &lt;A href="https://community.hortonworks.com/questions/10537/javalangnoclassdeffounderror-orgapachehadoophbaseh.html"&gt;post&lt;/A&gt; suggests but I get the same error..&lt;/P&gt;</description>
    <pubDate>Mon, 18 Apr 2016 18:10:13 GMT</pubDate>
    <dc:creator>zaher_mahdhi</dc:creator>
    <dc:date>2016-04-18T18:10:13Z</dc:date>
    <item>
      <title>Hbase Java API connection error</title>
      <link>https://community.cloudera.com/t5/Archives-of-Support-Questions/Hbase-Java-API-connection-error/m-p/103732#M25441</link>
      <description>&lt;P&gt;
	Hi,&lt;/P&gt;&lt;P&gt;
	I'm trying to connect from A java Application to Hbase like this:&lt;/P&gt;
&lt;PRE&gt;Configuration config = HBaseConfiguration.create();
        config.set("hbase.zookeeper.quorum", "localhost");
        config.set("hbase.zookeeper.property.clientPort", "2181");
        config.set("zookeeper.znode.parent", "/hbase-unsecure");
        
        config.set("hbase.client.retries.number", Integer.toString(0));
        config.set("zookeeper.session.timeout", Integer.toString(60000));
        config.set("zookeeper.recovery.retry", Integer.toString(0));
        
        Connection conn = ConnectionFactory.createConnection(config);
        TableName TABLE_NAME = TableName.valueOf("weblog");
        Table table = conn.getTable(TABLE_NAME);
        Result r = table.get(new Get(Bytes.toBytes("row1")));
        System.out.println(r);
&lt;/PRE&gt;&lt;P&gt;
	I builded the App into a JAR but when running it on the cluster with :&lt;/P&gt;
&lt;PRE&gt;hadoop jar hbaseConnect-0.0.1-SNAPSHOT.jar com.packagename.hbaseConnect.HbaseConnect
&lt;/PRE&gt;&lt;P&gt;
	 i get the following error:&lt;/P&gt;
&lt;PRE&gt;Exception in thread "main" java.lang.NoClassDefFoundError: org/apache/hadoop/hbase/HBaseConfiguration
    at com.DigiMerket.hbaseConnect.HbaseConnect.main(HbaseConnect.java:23)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:497)
    at org.apache.hadoop.util.RunJar.run(RunJar.java:221)
    at org.apache.hadoop.util.RunJar.main(RunJar.java:136)
Caused by: java.lang.ClassNotFoundException: org.apache.hadoop.hbase.HBaseConfiguration
    at java.net.URLClassLoader.findClass(URLClassLoader.java:381)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:424)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:357)
    ... 7 more
&lt;/PRE&gt;&lt;P&gt;
	I tried to add HBASE_CLASSPATH to HADOOP_CLASSPATH in hadoop-env like this &lt;A href="https://community.hortonworks.com/questions/10537/javalangnoclassdeffounderror-orgapachehadoophbaseh.html"&gt;post&lt;/A&gt; suggests but I get the same error..&lt;/P&gt;</description>
      <pubDate>Mon, 18 Apr 2016 18:10:13 GMT</pubDate>
      <guid>https://community.cloudera.com/t5/Archives-of-Support-Questions/Hbase-Java-API-connection-error/m-p/103732#M25441</guid>
      <dc:creator>zaher_mahdhi</dc:creator>
      <dc:date>2016-04-18T18:10:13Z</dc:date>
    </item>
    <item>
      <title>Re: Hbase Java API connection error</title>
      <link>https://community.cloudera.com/t5/Archives-of-Support-Questions/Hbase-Java-API-connection-error/m-p/103733#M25442</link>
      <description>&lt;P&gt;If you will run the following command (hadoop classpath) then you will be able to see that by default the HBase JARs will not be added to the "hadoop" command line utility.&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;# hadoop classpath&lt;/STRONG&gt; &lt;/P&gt;&lt;P&gt;Also you can also try setting the "HADOOP_CLASSPATH" as following and then in the same terminal run your hadoop/hbase jar:&lt;/P&gt;&lt;PRE&gt;export HADOOP_CLASSPATH="$HADOOP_CLASSPATH:/usr/hdp/2.3.4.0-3485/hbase/lib/hbase-client.jar:/usr/hdp/2.3.4.0-3485/hbase/lib/hbase-common.jar:/usr/hdp/2.3.4.0-3485/hbase/lib/hbase-protocol-1.1.2.2.3.4.0-3485.jar:.:" 


hadoop  jar  hbaseConnect-0.0.1-SNAPSHOT.jar com.packagename.hbaseConnect.HbaseConnect&lt;/PRE&gt;</description>
      <pubDate>Mon, 18 Apr 2016 19:45:15 GMT</pubDate>
      <guid>https://community.cloudera.com/t5/Archives-of-Support-Questions/Hbase-Java-API-connection-error/m-p/103733#M25442</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2016-04-18T19:45:15Z</dc:date>
    </item>
    <item>
      <title>Re: Hbase Java API connection error</title>
      <link>https://community.cloudera.com/t5/Archives-of-Support-Questions/Hbase-Java-API-connection-error/m-p/103734#M25443</link>
      <description>&lt;P&gt;Hi &lt;A rel="user" href="https://community.cloudera.com/users/3823/joysensharma.html" nodeid="3823"&gt;@Joy&lt;/A&gt; 
The solution you proposed worked, I'm getting a new error not related to a jar dependency. To make this fix permanent should I add that line to hadoop-env ? &lt;/P&gt;</description>
      <pubDate>Mon, 18 Apr 2016 20:12:24 GMT</pubDate>
      <guid>https://community.cloudera.com/t5/Archives-of-Support-Questions/Hbase-Java-API-connection-error/m-p/103734#M25443</guid>
      <dc:creator>zaher_mahdhi</dc:creator>
      <dc:date>2016-04-18T20:12:24Z</dc:date>
    </item>
    <item>
      <title>Re: Hbase Java API connection error</title>
      <link>https://community.cloudera.com/t5/Archives-of-Support-Questions/Hbase-Java-API-connection-error/m-p/103735#M25444</link>
      <description>&lt;P&gt;hey,did you solved the issue ..i am getting the same error ..please help me with this&lt;/P&gt;&lt;P&gt;hadoop jar newtable-0.0.1-SNAPSHOT.jar newtable.createtable&lt;/P&gt;&lt;P&gt;   Exception in thread "main" java.lang.NoClassDefFoundError: org/apache/hadoop/hbase/HBaseConfiguration&lt;BR /&gt;  at newtable.createtable.main(createtable.java:17)&lt;BR /&gt;  at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)&lt;BR /&gt;  at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)&lt;BR /&gt;  at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)&lt;BR /&gt;  at java.lang.reflect.Method.invoke(Method.java:498)&lt;BR /&gt;  at org.apache.hadoop.util.RunJar.run(RunJar.java:234)&lt;BR /&gt;  at org.apache.hadoop.util.RunJar.main(RunJar.java:148)&lt;BR /&gt;   Caused by: java.lang.ClassNotFoundException: org.apache.hadoop.hbase.HBaseConfiguration&lt;BR /&gt;  at java.net.URLClassLoader.findClass(URLClassLoader.java:381)&lt;/P&gt;</description>
      <pubDate>Sun, 20 Aug 2017 14:51:23 GMT</pubDate>
      <guid>https://community.cloudera.com/t5/Archives-of-Support-Questions/Hbase-Java-API-connection-error/m-p/103735#M25444</guid>
      <dc:creator>shashankshekhar</dc:creator>
      <dc:date>2017-08-20T14:51:23Z</dc:date>
    </item>
  </channel>
</rss>

