Support Questions
Find answers, ask questions, and share your expertise
Announcements
Alert: Welcome to the Unified Cloudera Community. Former HCC members be sure to read and learn how to activate your account here.

HBase Java Connection Error

HBase Java Connection Error

New Contributor

I am trying to connect to the Hortonworks VM out of the box, only thing that is not out of the box is that I ran the start_hbase.sh at the first folder upon logging in, after running start_hbase.sh and running the following code on my local machine....

            HBaseConfiguration config = new HBaseConfiguration();
            config.clear();
            config.set("hbase.zookeeper.quorum", "localhost");
            config.set("hbase.zookeeper.property.clientPort","2181");
            config.set("zookeeper.znode.parent", "/hbase-unsecure");
            //config.set("hbase.master", "localhost:60000");
            HBaseAdmin.checkHBaseAvailable(config);

I get the following error

java.lang.IllegalArgumentException: Not a host:port pair: PBUF
#
sandbox.hortonworks.com�}�����* �}
 at org.apache.hadoop.hbase.util.Addressing.parseHostname(Addressing.java:60)
 at org.apache.hadoop.hbase.ServerName.<init>(ServerName.java:96)
 at org.apache.hadoop.hbase.ServerName.parseVersionedServerName(ServerName.java:278)
 at org.apache.hadoop.hbase.MasterAddressTracker.bytesToServerName(MasterAddressTracker.java:77)
 at org.apache.hadoop.hbase.MasterAddressTracker.getMasterAddress(MasterAddressTracker.java:61)
 at org.apache.hadoop.hbase.client.HConnectionManager$HConnectionImplementation.getMaster(HConnectionManager.java:631)
 at org.apache.hadoop.hbase.client.HBaseAdmin.<init>(HBaseAdmin.java:106)
 at org.apache.hadoop.hbase.client.HBaseAdmin.checkHBaseAvailable(HBaseAdmin.java:1553)
 at com.clearsense.apps.mews.hadoop.HBaseTest.testHBaseConnection(HBaseTest.java:29)
 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:498)
 at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:50)
 at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:12)
 at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:47)
 at org.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeMethod.java:17)
 at org.junit.runners.ParentRunner.runLeaf(ParentRunner.java:325)
 at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:78)
 at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:57)
 at org.junit.runners.ParentRunner$3.run(ParentRunner.java:290)
 at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:71)
 at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:288)
 at org.junit.runners.ParentRunner.access$000(ParentRunner.java:58)
 at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:268)
 at org.junit.runners.ParentRunner.run(ParentRunner.java:363)
 at org.junit.runner.JUnitCore.run(JUnitCore.java:137)
 at com.intellij.junit4.JUnit4IdeaTestRunner.startRunnerWithArgs(JUnit4IdeaTestRunner.java:119)
 at com.intellij.junit4.JUnit4IdeaTestRunner.startRunnerWithArgs(JUnit4IdeaTestRunner.java:42)
 at com.intellij.rt.execution.junit.JUnitStarter.prepareStreamsAndStart(JUnitStarter.java:234)
 at com.intellij.rt.execution.junit.JUnitStarter.main(JUnitStarter.java:74)

This is my echo stat | nc localhost 2181

4983-capture.png

When I try to telenet into 2181 with putty on my desktop I get a Connection closed by remote host.....

Here are my port forwards showing 2181 is open...

4984-capture.png

And here is a netstat -an | grep 2181

4985-capture.png

4986-capture.png

4987-capture.png

Can anyone point me in the right direction please? I am not sure what is going on.... Thanks a lot for the help.

Here are also the git repos that I have tried and I also get errors trying to connect with them using the HBase code.

https://github.com/spring-projects/spring-hadoop-samples/

And

https://github.com/spring-projects/spring-data-book/tree/master/hadoop

13 REPLIES 13
Highlighted

Re: HBase Java Connection Error

hello justin

This has happened before in version mismatch could you check the versions of Hbase client you are using to and Hbase cluster

Re: HBase Java Connection Error

New Contributor

@nmaillard by version of HBase client you are referring to the code that is on my local machine right? The only reason I ask this is because I have seen folders referring to HBase-Client. (Which I am assuming this is just for VM client access) but I just want to verify. Also how can I tell which version my HBase-Server is running, when I am in the hbase shell and type version i get 1.1.2.2.4.0.0-169 but my client looks like it is 0.92.1?

Re: HBase Java Connection Error

Super Collaborator

Can you check zookeeper server log to see if there is any error ?

Check master / region server logs to see if hbase came up.

Re: HBase Java Connection Error

New Contributor

Do you happen to know where these logs reside? There are about 4 different folders that I believe are related to zookeeper and I have no idea which one is running. And I also have no idea how to tell which folder is being used. And every google search points me to different directories :(

Re: HBase Java Connection Error

Super Collaborator

bq. config.clear();

Why is the above statement needed ?

If hbase-site.xml is on the classpath of the client (it should be), newHBaseConfiguration() would give you all the config needed.

Re: HBase Java Connection Error

New Contributor

Ok, I need a little clarification here, and I hope I dont sound stupid... So I have my code on my desktop and I do not have any hbase-site.xml anywhere on my desktop. I did see the hbase-site.xml in the HBase directory on the VirtualBox but I did not mess with that. Also when people say client, are we talking about my code on the desktop? Because I see a HBase-Client folder and I am assuming that is for connections on the VM. So my "Client" would be the code on my desktop correct? Sorry if this is worded weird.

Re: HBase Java Connection Error

Yeah, make sure /etc/hbase/conf/hbase-site.xml is also on your client's classpath (and that the network names you are addressable by your client e.g. sandbox.hortonworks.com resolves locally). HBaseConfiguration.get() will automatically extract values as long as its on your client's classpath.

Re: HBase Java Connection Error

New Contributor

@Josh Elser, Weird thing is I never put "sandbox.hortonworks.com" anywhere in the code. Could that also be an issue? I put localhost in the code as you can see above....

Re: HBase Java Connection Error

Super Guru

check to see if your PC firewall is blocking it