问题
UPDATE: this is not a homebrew issue, I can confirm this because I get the exact same error when run HBase from the apache source.
Been struggling to get HBase on my laptop for testing. Basically I install HBase on my mac by using:
brew install hbase but when I go into the hbase shell and issue a command I get this error:
Exception in thread "main" java.lang.NoClassDefFoundError: org/apache/zookeeper/KeeperException
I'm tried to install zookeeper(brew install zookeeper) but still no luck. After reading into the message it turns out that hbase has its own class path and needs the included zookeeper jar's in it. I've been struggling with this as I use eclipse and just put all my jars in the build path, I never really deal with the command line. I did a search and the jar is in the directory(/usr/local/Cellar/hbase//0.92.0/libexec/lib/zookeeper-3.4.2.jar) but not sure how to add it.
I've been trying every variation of export CLASSPATH=/usr/local/Cellar/hbase/0.92.0/libexec/lib/zookeeper-3.4.2.jar:$CLASSPATH(got the idea [here][1]) that I can think of but still no luck, I keep getting the same error.
I'm wondering if I'm assigning the class path correctly? or if HBase has its own of assigning the class path?
回答1:
I ran into the same problem while trying to start up hbase 0.94.1.
I fixed this by editing the file "/usr/local/hbase-0.94.1/conf/hbase-env.sh" and adding the element "export HBASE_CLASSPATH=/usr/local/hbase-0.94.1/lib".
The zookeeper JAR is located in the HBase installation at "/usr/local/hbase-0.94.1/lib".
回答2:
This wasnt working for me. I created a small bulk import project on github. You can find there under lib/ folder zookeeper jar, as well as other used jars. Not sure what jar files are not needed.
To add a jar file in Eclipse:
Project/Properties/Add Jars../ go to libs folder and select all jars
Link: HBase Bulk Load Example
回答3:
Or make sure you add HBASE_HOME to your environment variables (with the path to your hbase folder).
来源:https://stackoverflow.com/questions/10290223/hbase-java-lang-noclassdeffounderror-classpath-error