简体   繁体   English

HBase java.lang.NoClassDefFoundError类路径错误

[英]HBase java.lang.NoClassDefFoundError classpath error

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. 更新:这不是一个自制问题,我可以确认这一点,因为从apache源运行HBase时,我得到了完全相同的错误。

Been struggling to get HBase on my laptop for testing. 一直努力将HBase放在我的笔记本电脑上进行测试。 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: 基本上,我使用以下命令在Mac上安装HBase: brew install hbase但是当我进入hbase shell并发出命令时,出现此错误:

Exception in thread "main" java.lang.NoClassDefFoundError: org/apache/zookeeper/KeeperException 线程“主”中的异常java.lang.NoClassDefFoundError:org / apache / zookeeper / KeeperException

I'm tried to install zookeeper( brew install zookeeper ) but still no luck. 我试图安装zookeeper( brew install zookeeper ),但还是没有运气。 After reading into the message it turns out that hbase has its own class path and needs the included zookeeper jar's in it. 阅读该消息后,发现hbase具有自己的类路径,并且需要其中包含的zookeeper jar。 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. 当我使用eclipse并将所有jars放入构建路径时,我一直在为此苦苦挣扎,但我从未真正处理过命令行。 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. 我进行了搜索,该jar位于目录( /usr/local/Cellar/hbase//0.92.0/libexec/lib/zookeeper-3.4.2.jar )中,但不确定如何添加它。

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. 我一直在尝试export CLASSPATH=/usr/local/Cellar/hbase/0.92.0/libexec/lib/zookeeper-3.4.2.jar:$CLASSPATH每个变体(在[这里] [1]有了主意),我可以想到,但仍然没有运气,我一直遇到同样的错误。

I'm wondering if I'm assigning the class path correctly? 我想知道我是否正确分配了类路径? or if HBase has its own of assigning the class path? 还是HBase有自己的分配类路径?

I ran into the same problem while trying to start up hbase 0.94.1. 尝试启动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". 我通过编辑文件“ /usr/local/hbase-0.94.1/conf/hbase-env.sh”并添加元素“ 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". zookeeper JAR位于HBase安装中的“ /usr/local/hbase-0.94.1/lib”。

This wasnt working for me. 这不是为我工作。 I created a small bulk import project on github. 我在github上创建了一个小批量导入项目。 You can find there under lib/ folder zookeeper jar, as well as other used jars. 您可以在lib /文件夹zookeeper jar以及其他二手的jar下找到该文件。 Not sure what jar files are not needed. 不知道不需要哪些jar文件。

To add a jar file in Eclipse: 要在Eclipse中添加jar文件:

Project/Properties/Add Jars../ go to libs folder and select all jars

Link: HBase Bulk Load Example 链接: HBase批量加载示例

或确保将HBASE_HOME添加到环境变量(以及hbase文件夹的路径)中。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM