Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

HBase 0.92 Standalone on Windows with Cygwin

Tags:

java

cygwin

hbase

Does anybody know a tutorial how HBase can be run on Windows under Cygwin?

I managed to setup everything such as the keys for auto login with SSH but Im stuck with following error message:

localhost: +======================================================================+
localhost: |      Error: JAVA_HOME is not set and Java could not be found         |
localhost: +----------------------------------------------------------------------+
localhost: | Please download the latest Sun JDK from the Sun Java web site        |
localhost: |       > http://java.sun.com/javase/downloads/ <                      |
localhost: |                                                                      |
localhost: | HBase requires Java 1.6 or later.                                    |
localhost: | NOTE: This script will find Sun Java whether you install using the   |
localhost: |       binary or the RPM based installer.                             |
localhost: +======================================================================+

...

java.lang.NoClassDefFoundError: org/apache/zookeeper/KeeperException
        at java.lang.Class.getDeclaredMethods0(Native Method)
        at java.lang.Class.privateGetDeclaredMethods(Unknown Source)
        at java.lang.Class.getMethod0(Unknown Source)
        at java.lang.Class.getMethod(Unknown Source)
        at sun.launcher.LauncherHelper.getMainMethod(Unknown Source)
        at sun.launcher.LauncherHelper.checkAndLoadMain(Unknown Source)
Caused by: java.lang.ClassNotFoundException: org.apache.zookeeper.KeeperException
        at java.net.URLClassLoader$1.run(Unknown Source)
        at java.net.URLClassLoader$1.run(Unknown Source)

I already set .bash_profile to point to:

export JAVA_HOME='/usr/lib/jre1.6.1'

which is symbolic link on the real jre

/usr/lib/jre1.6.1 -> /cygdrive/c/Java/jre7/
like image 387
Jack Gibson Avatar asked Jun 07 '12 17:06

Jack Gibson


2 Answers

I had the same issue and I found following: Cygwin use ":" as a path separator. But script that creates CLASS_PATH works incorrectly. Final CLASS_PATH looks like "...:zookeeper.jar:" with ":" at the end. Before run java script converting CLASS_PATH to Windows style. But with ":" at the end !!

So my solution is: just create an empty file "zzz.jar" under hbase/lib. zzz.jar will be very last in CLASS_PATH and zookeeper.jar will be added to CLASS_PATH correctly.

I know it is better to fix script, but I who cares :) I need HBase for 2 days only, so it works and I am happy :)

like image 101
shapkin Avatar answered Sep 22 '22 14:09

shapkin


For JAVA_HOME error, you can fix it by setting JAVA_HOME in the hbase\conf\hbase-env.sh.

For the class not found exception, try adding the hbase\lib to the HBASE_CLASSPATH under the same file.

Personally, I use the following two lines in my hbase-env.sh on a Windows 7 Environment + Cygwin:

export JAVA_HOME=/cygdrive/c/Program\ Files/Java/jdk1.7.0/

export HBASE_CLASSPATH=/cygdrive/c/programs/hbase-0.92.1/lib/
like image 30
Hisham Avatar answered Sep 19 '22 14:09

Hisham