问题
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/
回答1:
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 :)
回答2:
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/
回答3:
Use a VM to run hadoop in a Linux environment. With Java you may be facing issues typical under windows, adding Cygwin to the mix adds a whole other set, for example:
- spaces in the include path
- multiple installations of java from different applications (e.g. browser plugins) can mess up the consistency of the the CLASSPATH, JAVA_HOME and PATH variables
- shell script path/syntax issues
For tutorial purposes I highly recommend the cloudera demo VM and tutorial: https://ccp.cloudera.com/display/SUPPORT/Cloudera%27s+Hadoop+Demo+VM
https://ccp.cloudera.com/display/SUPPORT/Hadoop+Tutorial#HadoopTutorial-Purpose
回答4:
EDIT:
The first error looks like Java is not being found, but the second error is clearly coming from Java, so the combination of these two errors is somewhat confusing. Are you sure that they are both being produced by the same script at the same time?
The second error is caused by not having the zookeeper jar file on the classpath. Try modifying the script or copying the jar into the hadoop lib dir.
回答5:
hbase_classpath
is not need, just change zookeeper.jar
to azookeeper.jar
来源:https://stackoverflow.com/questions/10936924/hbase-0-92-standalone-on-windows-with-cygwin