You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@hbase.apache.org by piyush mishra <mp...@gmail.com> on 2014/11/26 14:30:17 UTC
Re: Hbase client do not able to connect with remote Hbase server
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.
Re: Hbase client do not able to connect with remote Hbase server
Posted by Ted Yu <yu...@gmail.com>.
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 <mp...@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.
>