简体   繁体   English

hbase与java客户端的连接

[英]hbase connection with java client

I have a java program ( eclipse , Maven , windows7) to fill Hbase which exist on a VirtualBox from a service, the program works fine when I run it from eclipse . 我有一个java程序( eclipse , Maven , windows7)来填充来自服务的VirtualBox上存在的Hbase ,当我从eclipse运行它时程序运行正常。

But when i created an executable jar using the assembly plugin in Maven and run it from the cmd or from cygwin I get this error 但是,当我使用Mavenassembly plugin创建一个executable jar并从cmdcygwin运行它时,我收到此错误

> [2016-05-03 14:46:44,663][DEBUG] Reading reply sessionid:0x154769ed563000a, packet:: clientPath:null serverPath:null finished:false header:: 300,4  replyHeader:: 300,3632,-101  request:: '/hbase-unsecure/meta-region-server,F  response:: [2016-05-03 14:46:44,663][DEBUG] hconnection-0x6b63f5ff-0x154769ed563000a, quorum=sandbox:2181, baseZNode=/hbase-unsecure Unable to get data of znode /hbase-unsecure/meta-region-server because node does not exist (not an error) [2016-05-03 14:46:44,663][DEBUG] Looked up meta region location, connection=org.apache.hadoop.hbase.client.ZooKeeperRegistry@695e5335; servers = null [2016-05-03 14:46:44,689][DEBUG] Closing scanner id=-1

>org.apache.hadoop.hbase.client.RetriesExhaustedException: Can't get the locations
        at org.apache.hadoop.hbase.client.RpcRetryingCallerWithReadReplicas.getRegionLocations(RpcRetryingCallerWithReadReplicas.java:312)
        at org.apache.hadoop.hbase.client.ScannerCallableWithReplicas.call(ScannerCallableWithReplicas.java:153)
        at org.apache.hadoop.hbase.client.ScannerCallableWithReplicas.call(ScannerCallableWithReplicas.java:61)
        at org.apache.hadoop.hbase.client.RpcRetryingCaller.callWithoutRetries(RpcRetryingCaller.java:200)
        at org.apache.hadoop.hbase.client.ClientScanner.call(ClientScanner.java:320)
        at org.apache.hadoop.hbase.client.ClientScanner.nextScanner(ClientScanner.java:295)
        at org.apache.hadoop.hbase.client.ClientScanner.initializeScannerInConstruction(ClientScanner.java:160)
        at org.apache.hadoop.hbase.client.ClientScanner.<init>(ClientScanner.java:155)
        at org.apache.hadoop.hbase.client.HTable.getScanner(HTable.java:811)
        at org.apache.hadoop.hbase.MetaTableAccessor.fullScan(MetaTableAccessor.java:602)
        at org.apache.hadoop.hbase.MetaTableAccessor.tableExists(MetaTableAccessor.java:366)
        at org.apache.hadoop.hbase.client.HBaseAdmin.tableExists(HBaseAdmin.java:303)
        at org.apache.hadoop.hbase.client.HBaseAdmin.tableExists(HBaseAdmin.java:313)

Could any of you help me with this? 你能帮助我吗?

Some more information like the following may be helpful. 以下更多信息可能会有所帮助。 Run these commands in the virtualbox where you have the "hbase" command 在具有“hbase”命令的virtualbox中运行这些命令

hbase zkCli -server sandbox:2181

Once you connect, you can run, in the zkcli prompt: 连接后,您可以在zkcli提示符下运行:

ls /

Please paste the output of the above command. 请粘贴上述命令的输出。 The baseZnode of "/hbase-unsecure " does not seem to exist. “/ hbase-unsecure”的baseZnode似乎不存在。 In general the base znode is "/hbase". 通常,基本znode是“/ hbase”。

Kindly cross check the classpath of your running program by the java code, as suggested by @RamPrasadG 请按照@RamPrasadG的建议,通过java代码交叉检查正在运行的程序的类路径

System.out.println(System.getProperty("java.classpath"))

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM