首页 > 代码库 > hbase启动时遇到class not found 错误

hbase启动时遇到class not found 错误

问题描述:

1 当hbase自己运行时,没有问题,可以正常启动

2 当搭建完hadoop环境后,再启动报异常:

Exception in thread "main" java.lang.NoClassDefFoundError: org/apache/hadoop/hbase/util/HBaseConfToolCaused by: java.lang.ClassNotFoundException: org.apache.hadoop.hbase.util.HBaseConfTool        at java.net.URLClassLoader$1.run(URLClassLoader.java:202)        at java.security.AccessController.doPrivileged(Native Method)        at java.net.URLClassLoader.findClass(URLClassLoader.java:190)        at java.lang.ClassLoader.loadClass(ClassLoader.java:307)        at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:301)        at java.lang.ClassLoader.loadClass(ClassLoader.java:248)Could not find the main class: org.apache.hadoop.hbase.util.HBaseConfTool.  Program will exit.Exception in thread "main" java.lang.NoClassDefFoundError: org/apache/hadoop/hbase/zookeeper/ZKServerToolCaused by: java.lang.ClassNotFoundException: org.apache.hadoop.hbase.zookeeper.ZKServerTool        at java.net.URLClassLoader$1.run(URLClassLoader.java:202)        at java.security.AccessController.doPrivileged(Native Method)        at java.net.URLClassLoader.findClass(URLClassLoader.java:190)        at java.lang.ClassLoader.loadClass(ClassLoader.java:307)        at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:301)        at java.lang.ClassLoader.loadClass(ClassLoader.java:248)Could not find the main class: org.apache.hadoop.hbase.zookeeper.ZKServerTool.  Program will exit.

解决方法:

在conf/hbase-env.sh文件中增加一行:export HBASE_CLASSPATH=$HBASE_HOME/lib

 

问题出现的原因,可能是hbase将hadoop的根目录当成自己的根目录了...

不能确定,谁知道为什么了可以留言给我