简体   繁体   中英

Hbase java.lang.NoClassDefFoundError: org/apache/hadoop/hbase/MasterNotRunningException

I'm running my hbase program using

java -classpath run.jar com.mycompany.app.HBaseImporter test2 /home/rahulko/Downloads/my-app/xaa

I have specified the HADOOP_CLASSPATH in hadoop.env.sh like this

 for f in $HADOOP_HOME/contrib/capacity-scheduler/*.jar; do
 if [ "$HADOOP_CLASSPATH" ]; then
 export HADOOP_CLASSPATH=$HADOOP_CLASSPATH:$f
 else
 export HADOOP_CLASSPATH=$f
 fi
 done


export HADOOP_CLASSPATH="$HBASE_HOME/lib/hbase-client-0.98.18-hadoop2.jar:\
$HBASE_HOME/lib/hbase-common-0.98.18-hadoop2.jar:\
$HBASE_HOME/lib/protobuf-java-2.5.0.jar:\
$HBASE_HOME/lib/guava-12.0.1.jar:\
$HBASE_HOME/lib/zookeeper-3.4.6.jar:\
$HBASE_HOME/lib/hbase-protocol-0.98.18-hadoop2.jar"

I have also specified in bashrc

export CLASSPATH=$CLASSPATH:/usr/local/hbase1/lib/*:/usr/local/hadoop/share/hadoop/common/*

But I'm still getting java.lang.NoClassDefFoundError: org/apache/hadoop/hbase/MasterNotRunningException

But when I run from eclipse the program runs successfully

Solved it using

java -cp "run.jar:/usr/local/hbase1/lib/*" com.mycompany.app.HBaseImporter test2 /home/rahulko/Downloads/my-app/xaa

mkdir like libs and put you dependents jar into this

and run this command:

java -Djava.ext.dirs=/xxx/xxx/libs -jar /xxx/xxx/you program jar

that can auto use the dependents jar

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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