Support Questions

Find answers, ask questions, and share your expertise
Announcements
Celebrating as our community reaches 100,000 members! Thank you!

Wrong Zookeeper Client Information listed in Eclipse Java Program

avatar
Contributor

The below environment variables are wrong and seem to be from my local machine. I would expect Zookeeper to list the variables from my Sandbox on VirtualBox

2016-05-31 16:04:05,796 INFO [main] zookeeper.ZooKeeper: Client environment:zookeeper.version=3.4.6-1569965, built on 02/20/2014 09:09 GMT

2016-05-31 16:04:05,796 INFO [main] zookeeper.ZooKeeper: Client environment:host.name=daniel

2016-05-31 16:04:05,796 INFO [main] zookeeper.ZooKeeper: Client environment:java.version=1.7.0_72

2016-05-31 16:04:05,796 INFO [main] zookeeper.ZooKeeper: Client environment:java.vendor=Oracle Corporation

2016-05-31 16:04:05,796 INFO [main] zookeeper.ZooKeeper: Client environment:java.home=C:\Java\jdk1.7.0_72\jre

1 ACCEPTED SOLUTION

avatar
Super Guru

all these value are getting picked up from your env variable http://grepcode.com/file/repo1.maven.org/maven2/org.apache.zookeeper/zookeeper/3.3.1/org/apache/zook...

please check your env variable

View solution in original post

16 REPLIES 16

avatar
Super Guru

all these value are getting picked up from your env variable http://grepcode.com/file/repo1.maven.org/maven2/org.apache.zookeeper/zookeeper/3.3.1/org/apache/zook...

please check your env variable

avatar
Contributor

How would I ensure it picks up the values from my VM.

avatar
Super Guru

is there any zk client is running on your local machine which is trying to connect to zk-server running on vm?

avatar
Contributor

No. There is not zk client running on my local machine. I think my java program fails to connect to zookeper. I get the below error as well

2016-05-31 16:04:05,827 INFO [main-SendThread(0:0:0:0:0:0:0:1:2181)] zookeeper.ClientCnxn: Opening socket connection to server 0:0:0:0:0:0:0:1/0:0:0:0:0:0:0:1:2181. Will not attempt to authenticate using SASL (unknown error) 2016-05-31 16:04:06,830 WARN [main-SendThread(0:0:0:0:0:0:0:1:2181)] zookeeper.ClientCnxn: Session 0x0 for server null, unexpected error, closing socket connection and attempting reconnect java.net.ConnectException: Connection refused: no further information at

sun.nio.ch.SocketChannelImpl.checkConnect(Native Method) at

sun.nio.ch.SocketChannelImpl.finishConnect(SocketChannelImpl.java:739) at

org.apache.zookeeper.ClientCnxnSocketNIO.doTransport(ClientCnxnSocketNIO.java:361) at

org.apache.zookeeper.ClientCnxn$SendThread.run(ClientCnxn.java:1081)

2016-05-31 16:04:06,935 INFO [main-SendThread(127.0.0.1:2181)] zookeeper.ClientCnxn: Opening socket connection to server 127.0.0.1/127.0.0.1:2181. Will not attempt to authenticate using SASL (unknown error)

2016-05-31 16:04:06,945 WARN [main] zookeeper.RecoverableZooKeeper: Possibly transient ZooKeeper, quorum=localhost:2181, exception=org.apache.zookeeper.KeeperException$ConnectionLossException: KeeperErrorCode = ConnectionLoss for /hbase/hbaseid

2016-05-31 16:04:07,937 WARN [main-SendThread(127.0.0.1:2181)] zookeeper.ClientCnxn: Session 0x0 for server null, unexpected error, closing socket connection and attempting reconnect java.net.ConnectException: Connection refused: no further information

avatar
Master Collaborator

@Daniel Buraimo

Are you trying to connect to hbase cluster ?

In your pom.xml, you should have dependency similar to the following:

[INFO] | +- org.apache.zookeeper:zookeeper:jar:3.4.6:compile

In your hbase-site.xml, the following two config parameters should have the correct values:

<property> <name>hbase.zookeeper.quorum</name>

</property>

<property> <name>zookeeper.znode.parent</name> <value>/hbase-unsecure</value> </property>

avatar
Contributor

Yes I'm trying to connect to an hbase cluster to perform CRUD oeprations on tables. My java program currently looks like this

Configuration conf = HBaseConfiguration.create();

try { HBaseAdmin.checkHBaseAvailable(conf);

}

catch (Exception e) {

// TODO Auto-generated catch block

e.printStackTrace();

}

HBase Version 1.1.2.2.4.0.0-169, revision=61dfb2b344f424a11f93b3f086eab815c1eb0b6a
ZooKeeper Client Version3.4.6-169, revision=-1
Zookeeper Quorumsandbox.hortonworks.com:2181
Zookeeper Base Path/hbase-unsecure
Hadoop Version2.7.1.2.4.0.0-169, revision=26104d8ac833884c8776473823007f176854f2eb

All information gotten from Ambari Dashboard. The hbase-site xml were also downloaded from the Ambari dashboard. I'm currently using hbase-1.1.5 bin version jars in my local java project. I also had to set a local hadoop home directory in vm arguments because I got the below error

2016-06-01 10:12:17,088 ERROR [main] util.Shell: Failed to locate the winutils binary in the hadoop binary path java.io.IOException: Could not locate executable null\bin\winutils.exe in the Hadoop binaries.

avatar
Master Collaborator

The hbase-site xml didn't seem to be on your classpath - that was why 0:0:0:0:0:0:0:1:2181 appeared in the log.

Once you put hbase-site.xml on classpath, you should be able to connect.

avatar
Contributor

I've put the hbase-site.xml in the classpath. I get an updated log which I've atatchederrorlog.txt

Thank you for your help

avatar
Contributor

I also added the following to my local windows host file

127.0.0.1 localhost

10.0.2.15 sandbox sandbox.hortonworks.com