hbase-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Ted Yu <yuzhih...@gmail.com>
Subject Re: Hbase client do not able to connect with remote Hbase server
Date Wed, 26 Nov 2014 15:57:07 GMT
Your client misses imports. e.g.
import org.apache.hadoop.conf.Configuration;

Please refer to unit tests, such as
hbase-server/src/test/java/org/apache/hadoop/hbase/client/TestAdmin1.java

Cheers

On Wed, Nov 26, 2014 at 5:30 AM, piyush mishra <mpecpiyush46@gmail.com>
wrote:

> hii all of you,
>
>  I want to connect hbase remotely using my java client.
>
> here my java code is :
>
> public class CreateTable {
> public static void main(String[] agrs) {
> // CONFIGURATION
>
> // ENSURE RUNNING
> try {
> /*Configuration hbaseConfig ;
> hbaseConfig = HBaseConfiguration.create(); */
> Configuration hbaseConfig = HBaseConfiguration.create();
> hbaseConfig.set("hbase.zookeeper.quorum", "maprdemo");
> hbaseConfig.set("hbase.zookeeper.property.clientPort","5181");
> /* hbaseConfig.set("hbase.master", "maprdemo:5181"); */
> /* hbaseConfig.set(“hbase.master”, “:60000″); */
> //*HBaseConfiguration config = HBaseConfiguration.create(); */
> //config.set(“hbase.zookeeper.quorum”, “localhost”); // Here we are running
> zookeeper locally */
> HBaseAdmin.checkHBaseAvailable(hbaseConfig);
> System.out.println("HBase is running!");
> //*createTable(config);
> //creating a new table */
> HTable table = new HTable(hbaseConfig, "mytest");
> System.out.println("Table mytable obtained ");
> //   addData(table);
> }
> catch (MasterNotRunningException e) {
> System.out.println("HBase is not running!");
> System.exit(1);
> }catch (Exception ce){ ce.printStackTrace(); }
>
> }
>
>  /*  private static void addData(HTable table) {
> // TODO Auto-generated method stub
>
> } */
>
> }
>
> When i compiled this using
> javac CreateTable.java
>
>
> i get this error:
>
> CreateTable.java:9: error: cannot find symbol
> Configuration hbaseConfig = HBaseConfiguration.create();
> ^
>   symbol:   class Configuration
>   location: class CreateTable
> CreateTable.java:9: error: cannot find symbol
> Configuration hbaseConfig = HBaseConfiguration.create();
>                             ^
>   symbol:   variable HBaseConfiguration
>   location: class CreateTable
> CreateTable.java:16: error: cannot find symbol
> HBaseAdmin.checkHBaseAvailable(hbaseConfig);
> ^
>   symbol:   variable HBaseAdmin
>   location: class CreateTable
> CreateTable.java:20: error: cannot find symbol
> HTable table = new HTable(hbaseConfig, "mytest");
> ^
>   symbol:   class HTable
>   location: class CreateTable
> CreateTable.java:20: error: cannot find symbol
> HTable table = new HTable(hbaseConfig, "mytest");
>                    ^
>   symbol:   class HTable
>   location: class CreateTable
> CreateTable.java:24: error: cannot find symbol
> catch (MasterNotRunningException e) {
>        ^
>   symbol:   class MasterNotRunningException
>   location: class CreateTable
>
>
> Please suggest me what i do..
>
>
>
>
> --
> View this message in context:
> http://apache-hbase.679495.n3.nabble.com/Hbase-client-do-not-able-to-connect-with-remote-Hbase-server-tp3430514p4066381.html
> Sent from the HBase Developer mailing list archive at Nabble.com.
>

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message