user7079832
user7079832

Reputation:

zookeeper Starting error :'JAVA_HOME error in zookeeper.out'

When I do

bin/zkServer.sh start    #It shows it has started

ZooKeeper JMX enabled by default
Using config: /data/sparkHA/zookeeper-3.4.9/bin/../conf/zoo.cfg
Starting zookeeper ... STARTED

Afetr few second when i check status, I got

ZooKeeper JMX enabled by default
Using config: /data/sparkHA/zookeeper-3.4.9/bin/../conf/zoo.cfg
Error contacting service. It is probably not running.

My zookeeper.out says

nohup: failed to run command â/usr/bin/java/bin/javaâ: Not a directory

But my JAVA_HOME in bashrc is usr/bin/java, How come one extra /bin/java is added , that results in an invalid directory.

Also echo $JAVA_HOME outputs

/usr/bin/java

How to approach this error. Please Help. Thanks.

Also tried setting JAVA_HOME in zkServer.sh also by following Zookeeper not starting, nohup error but getting same error.

Upvotes: 0

Views: 2976

Answers (1)

Maxim
Maxim

Reputation: 9961

Your JAVA_HOME point to /usr/bin/java file but it should point to root directory of your JDK. For example for me this is:

➜  ~ echo $JAVA_HOME
/Library/Java/JavaVirtualMachines/jdk1.8.0_112.jdk/Contents/Home
➜  ~ ll $JAVA_HOME
total 52064
-rw-rw-r--   1 root  wheel   3.2K Oct  1 09:00 COPYRIGHT
-rw-rw-r--   1 root  wheel    40B Oct  1 09:01 LICENSE
-rw-rw-r--   1 root  wheel   159B Oct  1 09:01 README.html
-rwxrwxr-x   1 root  wheel   108K Sep 22 22:49 THIRDPARTYLICENSEREADME-JAVAFX.txt
-rw-rw-r--   1 root  wheel   173K Oct  1 09:01 THIRDPARTYLICENSEREADME.txt
drwxrwxr-x  46 root  wheel   1.5K Oct  1 09:04 bin
drwxrwxr-x   9 root  wheel   306B Oct  1 09:00 db
drwxrwxr-x   9 root  wheel   306B Oct  1 09:00 include
-rwxrwxr-x   1 root  wheel   4.9M Sep 22 22:49 javafx-src.zip
drwxrwxr-x  10 root  wheel   340B Oct  1 09:02 jre
drwxrwxr-x  14 root  wheel   476B Oct  1 09:02 lib
drwxrwxr-x   5 root  wheel   170B Oct  1 09:01 man
-rw-rw-r--   1 root  wheel   529B Oct  1 09:01 release
-rw-rw-r--   1 root  wheel    20M Oct  1 09:01 src.zip

So, try to set valid path to JDK root directory. I think it should fix your problem.

Upvotes: 1

Related Questions