关于hbase-1.1.2启动时找不到类的问题分析

[root@n2 ~]# pwd
/root
[root@n2 ~]# hbase-1.1.2/bin/start-hbase.sh
starting master, logging to /root/hbase-1.1.2/bin/../logs/hbase-root-master-n2.out
Java HotSpot(TM) 64-Bit Server VM warning: ignoring option PermSize=128m; support was removed in 8.0
Java HotSpot(TM) 64-Bit Server VM warning: ignoring option MaxPermSize=128m; support was removed in 8.0
[root@n2 ~]# jsp
-bash: jsp: command not found
[root@n2 ~]# jps
5698 HMaster
5882 Jps
[root@n2 ~]# kill -9 5698
[root@n2 ~]# jps
5896 Jps
[root@n2 ~]# mv hbase-1.1.2 /usr/local/
[root@n2 ~]# /usr/local/hbase-1.1.2/bin/start-hbase.sh
Error: Could not find or load main class org.apache.hadoop.hbase.util.HBaseConfTool
Error: Could not find or load main class org.apache.hadoop.hbase.zookeeper.ZKServerTool
starting master, logging to /usr/local/hbase-1.1.2/bin/../logs/hbase-root-master-n2.out
Java HotSpot(TM) 64-Bit Server VM warning: ignoring option PermSize=128m; support was removed in 8.0
Java HotSpot(TM) 64-Bit Server VM warning: ignoring option MaxPermSize=128m; support was removed in 8.0
Error: Could not find or load main class org.apache.hadoop.hbase.master.HMaster
starting regionserver, logging to /usr/local/hbase-1.1.2/bin/../logs/hbase-root-1-regionserver-n2.out
Error: Could not find or load main class org.apache.hadoop.hbase.regionserver.HRegionServer

这个是下载的官方的hbase-1.1.2-src.tar.gz 下载到root家目录/root 然后编译成功后,移到/usr/local/ 后执行报错的。

当前目录下查找对应的class发现已经有了,说明编译了的。

 find ./ -name HBaseConfTool.java
/usr/local/hbase-1.1.2/hbase-server/src/main/java/org/apache/hadoop/hbase/util/HBaseConfTool.java

find ./ -name HBaseConfTool.class
/usr/local/hbase-1.1.2/hbase-server/target/classes/org/apache/hadoop/hbase/util/HBaseConfTool.class

一直很纠结这个问题,虽然知道一定是classpath的问题。最近终于找到了原因。

就是当时在root目录下maven编译时很多classpath就是在root下写死了,随便目前不知道怎么修改,但是终究是知道什么原因了。

还有一些带path目录的路径可能是跟我maven配置文件conf/setting.xml 设置了一个<localRepository>path</localRepository> 没写路径就默认在编译目录下建立了path文件夹,默认应该在${user.home}/.m2/repository 。

start-hbase.sh看到有获取是否设置了集群模式的配置这段:
bin/hbase –config “$HBASE_CONF_DIR” org.apache.hadoop.hbase.util.HBaseConfTool hbase.cluster.distributed
才想到找找bin/hbase–config -h查看相关参数 找到的查看classpath的方法。

分别尝试追加:
export HBASE_CLASSPATH=/usr/local/hbase-1.1.2
export HBASE_CLASSPATH=/usr/local/hbase-1.1.2/hbase-server/target/classes/

很多 设置hadoop的 让用hadoop的lib
export HBASE_CLASSPATH=/usr/local/hadoop/conf
老师视频里讲的:
export HBASE_CLASSPATH=/usr/local/hbase-1.1.2/conf

只是在命令看到的结果最后追加了 export的这个路径。因为启动起来依赖各种下面错误的路径的包,包括hbase-common,hbase-xx等。所以解决的办法还是应该怎么修改整个classpath,目前还没找到。可能为了避免这个问题 我先得去掉maven配置的那个本地库的目录设置,然后以后先把源码目录移到/usr/local/下编译,就不要移动到别处了。具体还要再实验一下,classpath跟着编译时目标定死了,这个有点坑,估计是有整体修改的方式,可能目前我还没找到而已。

/usr/local/hbase-1.1.2/bin/hbase –config conf classpath 查看运行时的classpath

/conf:/usr/local/jdk1.8.0_20/lib/tools.jar:/usr/local/hbase-1.1.2/bin/../hbase-server/:/root/hbase-1.1.2/hbase-it/target/hbase-it-1.1.2-tests.jar:/root/hbase-1.1.2/hbase-common/target/hbase-common-1.1.2.jar:/root/hbase-1.1.2/hbase-protocol/target/hbase-protocol-1.1.2.jar:/root/hbase-1.1.2/hbase-client/target/hbase-client-1.1.2.jar:/root/hbase-1.1.2/path/org/jruby/jcodings/jcodings/1.0.8/jcodings-1.0.8.jar:/root/hbase-1.1.2/path/org/jruby/joni/joni/2.1.2/joni-2.1.2.jar:/root/hbase-1.1.2/path/com/google/guava/guava/12.0.1/guava-12.0.1.jar:/root/hbase-1.1.2/path/com/google/code/findbugs/jsr305/1.3.9/jsr305-1.3.9.jar:/root/hbase-1.1.2/path/com/sun/jersey/jersey-client/1.9/jersey-client-1.9.jar:/root/hbase-1.1.2/path/com/yammer/metrics/metrics-/2.2.0/metrics-core-2.2.0.jar:/root/hbase-1.1.2/path/org/slf4j/slf4j-api/1.7.7/slf4j-api-1.7.7.jar:/root/hbase-1.1.2/path/commons-logging/commons-logging/1.2/commons-logging-1.2.jar:/root/hbase-1.1.2/path/commons-cli/commons-cli/1.2/commons-cli-1.2.jar:/root/hbase-1.1.2/path/org/apache/commons/commons-math/2.2/commons-math-2.2.jar:/root/hbase-1.1.2/path/commons-lang/commons-lang/2.6/commons-lang-2.6.jar:/root/hbase-1.1.2/path/org/apache/htrace/htrace-core/3.1.0-incubating/htrace-core-3.1.0-incubating.jar:/root/hbase-1.1.2/path/org/jboss/netty/netty/3.2.4.Final/netty-3.2.4.Final.jar:/root/hbase-1.1.2/path/org/apache/hadoop/hadoop-mapreduce-client-core/2.5.1/hadoop-mapreduce-client-core-2.5.1.jar:/root/hbase-1.1.2/path/org/apache/hadoop/hadoop-yarn-common/2.5.1/hadoop-yarn-common-2.5.1.jar:/root/hbase-1.1.2/path/javax/xml/bind/jaxb-api/2.2.2/jaxb-api-2.2.2.jar:/root/hbase-1.1.2/path/javax/activation/activation/1.1/activation-1.1.jar:/root/hbase-1.1.2/path/javax/servlet/servlet-api/2.5/servlet-api-2.5.jar:/root/hbase-1.1.2/path/org/codehaus/jackson/jackson-xc/1.9.13/jackson-xc-1.9.13.jar:/root/hbase-1.1.2/path/com/google/inject/guice/3.0/guice-3.0.jar:/root/hbase-1.1.2/path/javax/inject/javax.inject/1/javax.inject-1.jar:/root/hbase-1.1.2/path/aopalliance/aopalliance/1.0/aopalliance-1.0.jar:/root/hbase-1.1.2/path/com/sun/jersey/contribs/jersey-guice/1.9/jersey-guice-1.9.jar:/root/hbase-1.1.2/path/org/apache/avro/avro/1.7.4/avro-1.7.4.jar:/root/hbase-1.1.2/path/com/thoughtworks/paranamer/paranamer/2.3/paranamer-2.3.jar:/root/hbase-1.1.2/path/org/xerial/snappy/snappy-java/1.0.4.1/snappy-java-1.0.4.1.jar:/root/hbase-1.1.2/path/org/apache/hadoop/hadoop-annotations/2.5.1/hadoop-annotations-2.5.1.jar:/root/hbase-1.1.2/path/com/google/inject/extensions/guice-servlet/3.0/guice-servlet-3.0.jar:/root/hbase-1.1.2/path/org/apache/hadoop/hadoop-common/2.5.1/hadoop-common-2.5.1.jar:/root/hbase-1.1.2/path/org/apache/commons/commons-math3/3.1.1/commons-math3-3.1.1.jar:/root/hbase-1.1.2/path/xmlenc/xmlenc/0.52/xmlenc-0.52.jar:/root/hbase-1.1.2/path/commons-net/commons-net/3.1/commons-net-3.1.jar:/root/hbase-1.1.2/path/com/sun/jersey/jersey-json/1.9/jersey-json-1.9.jar:/root/hbase-1.1.2/path/org/codehaus/jettison/jettison/1.3.3/jettison-1.3.3.jar:/root/hbase-1.1.2/path/com/sun/xml/bind/jaxb-impl/2.2.3-1/jaxb-impl-2.2.3-1.jar:/root/hbase-1.1.2/path/commons-el/commons-el/1.0/commons-el-1.0.jar:/root/hbase-1.1.2/path/net/java/dev/jets3t/jets3t/0.9.0/jets3t-0.9.0.jar:/root/hbase-1.1.2/path/org/apache/httpcomponents/httpcore/4.1.2/httpcore-4.1.2.jar:/root/hbase-1.1.2/path/com/jamesmurty/utils/java-xmlbuilder/0.4/java-xmlbuilder-0.4.jar:/root/hbase-1.1.2/path/commons-configuration/commons-configuration/1.6/commons-configuration-1.6.jar:/root/hbase-1.1.2/path/commons-digester/commons-digester/1.8/commons-digester-1.8.jar:/root/hbase-1.1.2/path/commons-beanutils/commons-beanutils/1.7.0/commons-beanutils-1.7.0.jar:/root/hbase-1.1.2/path/commons-beanutils/commons-beanutils-core/1.8.0/commons-beanutils-core-1.8.0.jar:/root/hbase-1.1.2/path/com/jcraft/jsch/0.1.42/jsch-0.1.42.jar:/root/hbase-1.1.2/path/org/apache/commons/commons-compress/1.4.1/commons-compress-1.4.1.jar:/root/hbase-1.1.2/path/org/tukaani/xz/1.0/xz-1.0.jar:/root/hbase-1.1.2/hbase-server/target/hbase-server-1.1.2.jar:/root/hbase-1.1.2/hbase-procedure/target/hbase-procedure-1.1.2.jar:/root/hbase-1.1.2/hbase-prefix-tree/target/hbase-prefix-tree-1.1.2.jar:/root/hbase-1.1.2/path/commons-httpclient/commons-httpclient/3.1/commons-httpclient-3.1.jar:/root/hbase-1.1.2/path/commons-codec/commons-codec/1.9/commons-codec-1.9.jar:/root/hbase-1.1.2/path/commons-collections/commons-collections/3.2.1/commons-collections-3.2.1.jar:/root/hbase-1.1.2/path/com/google/protobuf/protobuf-java/2.5.0/protobuf-java-2.5.0.jar:/root/hbase-1.1.2/path/com/sun/jersey/jersey-core/1.9/jersey-core-1.9.jar:/root/hbase-1.1.2/path/com/sun/jersey/jersey-server/1.9/jersey-server-1.9.jar:/root/hbase-1.1.2/path/asm/asm/3.1/asm-3.1.jar:/root/hbase-1.1.2/path/commons-io/commons-io/2.4/commons-io-2.4.jar:/root/hbase-1.1.2/path/org/apache/zookeeper/zookeeper/3.4.6/zookeeper-3.4.6.jar:/root/hbase-1.1.2/path/org/mortbay/jetty/jetty/6.1.26/jetty-6.1.26.jar:/root/hbase-1.1.2/path/org/mortbay/jetty/jetty-util/6.1.26/jetty-util-6.1.26.jar:/root/hbase-1.1.2/path/org/mortbay/jetty/jetty-sslengine/6.1.26/jetty-sslengine-6.1.26.jar:/root/hbase-1.1.2/path/org/mortbay/jetty/jsp-2.1/6.1.14/jsp-2.1-6.1.14.jar:/root/hbase-1.1.2/path/org/mortbay/jetty/jsp-api-2.1/6.1.14/jsp-api-2.1-6.1.14.jar:/root/hbase-1.1.2/path/org/mortbay/jetty/servlet-api-2.5/6.1.14/servlet-api-2.5-6.1.14.jar:/root/hbase-1.1.2/path/org/codehaus/jackson/jackson-core-asl/1.9.13/jackson-core-asl-1.9.13.jar:/root/hbase-1.1.2/path/org/codehaus/jackson/jackson-mapper-asl/1.9.13/jackson-mapper-asl-1.9.13.jar:/root/hbase-1.1.2/path/org/codehaus/jackson/jackson-jaxrs/1.9.13/jackson-jaxrs-1.9.13.jar:/root/hbase-1.1.2/path/tomcat/jasper-compiler/5.5.23/jasper-compiler-5.5.23.jar:/root/hbase-1.1.2/path/tomcat/jasper-runtime/5.5.23/jasper-runtime-5.5.23.jar:/root/hbase-1.1.2/path/org/jamon/jamon-runtime/2.3.1/jamon-runtime-2.3.1.jar:/root/hbase-1.1.2/path/io/netty/netty-all/4.0.23.Final/netty-all-4.0.23.Final.jar:/root/hbase-1.1.2/path/com/lmax/disruptor/3.3.0/disruptor-3.3.0.jar:/root/hbase-1.1.2/path/org/apache/hadoop/hadoop-auth/2.5.1/hadoop-auth-2.5.1.jar:/root/hbase-1.1.2/path/org/apache/httpcomponents/httpclient/4.2.5/httpclient-4.2.5.jar:/root/hbase-1.1.2/path/org/apache/directory/server/apacheds-kerberos-codec/2.0.0-M15/apacheds-kerberos-codec-2.0.0-M15.jar:/root/hbase-1.1.2/path/org/apache/directory/server/apacheds-i18n/2.0.0-M15/apacheds-i18n-2.0.0-M15.jar:/root/hbase-1.1.2/path/org/apache/directory/api/api-asn1-api/1.0.0-M20/api-asn1-api-1.0.0-M20.jar:/root/hbase-1.1.2/path/org/apache/directory/api/api-util/1.0.0-M20/api-util-1.0.0-M20.jar:/root/hbase-1.1.2/path/org/apache/hadoop/hadoop-client/2.5.1/hadoop-client-2.5.1.jar:/root/hbase-1.1.2/path/org/apache/hadoop/hadoop-mapreduce-client-app/2.5.1/hadoop-mapreduce-client-app-2.5.1.jar:/root/hbase-1.1.2/path/org/apache/hadoop/hadoop-yarn-api/2.5.1/hadoop-yarn-api-2.5.1.jar:/root/hbase-1.1.2/path/org/apache/hadoop/hadoop-hdfs/2.5.1/hadoop-hdfs-2.5.1.jar:/root/hbase-1.1.2/path/commons-daemon/commons-daemon/1.0.13/commons-daemon-1.0.13.jar:/root/hbase-1.1.2/path/io/netty/netty/3.6.2.Final/netty-3.6.2.Final.jar:/root/hbase-1.1.2/hbase-hadoop-compat/target/hbase-hadoop-compat-1.1.2.jar:/root/hbase-1.1.2/hbase-hadoop2-compat/target/hbase-hadoop2-compat-1.1.2.jar:/root/hbase-1.1.2/hbase-annotations/target/hbase-annotations-1.1.2.jar:/usr/local/jdk1.8.0_20/jre/../lib/tools.jar:/root/hbase-1.1.2/hbase-shell/target/hbase-shell-1.1.2.jar:/root/hbase-1.1.2/path/org/jruby/jruby-complete/1.6.8/jruby-complete-1.6.8.jar:/root/hbase-1.1.2/hbase-testing-util/target/hbase-testing-util-1.1.2.jar:/root/hbase-1.1.2/hbase-common/target/hbase-common-1.1.2-tests.jar:/root/hbase-1.1.2/hbase-annotations/target/hbase-annotations-1.1.2-tests.jar:/root/hbase-1.1.2/hbase-server/target/hbase-server-1.1.2-tests.jar:/root/hbase-1.1.2/hbase-hadoop-compat/target/hbase-hadoop-compat-1.1.2-tests.jar:/root/hbase-1.1.2/hbase-hadoop2-compat/target/hbase-hadoop2-compat-1.1.2-tests.jar:/root/hbase-1.1.2/path/org/slf4j/slf4j-log4j12/1.7.7/slf4j-log4j12-1.7.7.jar:/root/hbase-1.1.2/path/org/apache/hadoop/hadoop-mapreduce-client-jobclient/2.5.1/hadoop-mapreduce-client-jobclient-2.5.1.jar:/root/hbase-1.1.2/path/org/apache/hadoop/hadoop-mapreduce-client-common/2.5.1/hadoop-mapreduce-client-common-2.5.1.jar:/root/hbase-1.1.2/path/org/apache/hadoop/hadoop-yarn-client/2.5.1/hadoop-yarn-client-2.5.1.jar:/root/hbase-1.1.2/path/org/apache/hadoop/hadoop-yarn-server-common/2.5.1/hadoop-yarn-server-common-2.5.1.jar:/root/hbase-1.1.2/path/org/apache/hadoop/hadoop-mapreduce-client-shuffle/2.5.1/hadoop-mapreduce-client-shuffle-2.5.1.jar:/root/hbase-1.1.2/path/org/apache/hadoop/hadoop-yarn-server-nodemanager/2.5.1/hadoop-yarn-server-nodemanager-2.5.1.jar:/root/hbase-1.1.2/path/org/fusesource/leveldbjni/leveldbjni-all/1.8/leveldbjni-all-1.8.jar:/root/hbase-1.1.2/path/org/apache/hadoop/hadoop-hdfs/2.5.1/hadoop-hdfs-2.5.1-tests.jar:/root/hbase-1.1.2/path/org/apache/hadoop/hadoop-minicluster/2.5.1/hadoop-minicluster-2.5.1.jar:/root/hbase-1.1.2/path/org/apache/hadoop/hadoop-common/2.5.1/hadoop-common-2.5.1-tests.jar:/root/hbase-1.1.2/path/org/apache/hadoop/hadoop-yarn-server-tests/2.5.1/hadoop-yarn-server-tests-2.5.1-tests.jar:/root/hbase-1.1.2/path/org/apache/hadoop/hadoop-yarn-server-resourcemanager/2.5.1/hadoop-yarn-server-resourcemanager-2.5.1.jar:/root/hbase-1.1.2/path/org/apache/hadoop/hadoop-yarn-server-applicationhistoryservice/2.5.1/hadoop-yarn-server-applicationhistoryservice-2.5.1.jar:/root/hbase-1.1.2/path/org/apache/hadoop/hadoop-yarn-server-web-proxy/2.5.1/hadoop-yarn-server-web-proxy-2.5.1.jar:/root/hbase-1.1.2/path/org/apache/hadoop/hadoop-mapreduce-client-jobclient/2.5.1/hadoop-mapreduce-client-jobclient-2.5.1-tests.jar:/root/hbase-1.1.2/path/org/apache/hadoop/hadoop-mapreduce-client-hs/2.5.1/hadoop-mapreduce-client-hs-2.5.1.jar:/root/hbase-1.1.2/hbase-resource-bundle/target/hbase-resource-bundle-1.1.2.jar:/root/hbase-1.1.2/path/com/github/stephenc/findbugs/findbugs-annotations/1.3.9-1/findbugs-annotations-1.3.9-1.jar:/root/hbase-1.1.2/path/log4j/log4j/1.2.17/log4j-1.2.17.jar:/root/hbase-1.1.2/path/junit/junit/4.11/junit-4.11.jar:/root/hbase-1.1.2/path/org/hamcrest/hamcrest-core/1.3/hamcrest-core-1.3.jar:/root/hbase-1.1.2/path/org/mockito/mockito-all/1.10.8/mockito-all-1.10.8.jar:/root/hbase-1.1.2/path/org/jmock/jmock-junit4/2.6.0/jmock-junit4-2.6.0.jar:/root/hbase-1.1.2/path/org/jmock/jmock/2.6.0/jmock-2.6.0.jar:/root/hbase-1.1.2/path/org/hamcrest/hamcrest-library/1.1/hamcrest-library-1.1.jar:/usr/local/hbase-1.1.2/bin/../lib/*.jar:

找了个干净的机器重新编译了一次,碰到一个错误用-Denforcer.skip=true 跳过了。

mvn package -Prelease -Dmaven.test.skip.exec=true -DskipTests -Denforcer.skip=true assembly:single -e

编译完成后bin包在  hbase-assembly/target/hbase-1.1.2-bin.tar.gz

移到/data,/data2分别 解压运行

/usr/local/hbase-1.1.2/bin/hbase –config conf classpath 查看classpath 路径都会随着当前路径变化。官网直接下载bin版本就是这样的效果。

终于解决了这个编译问题。^^

 

关于 Administrator

爱拼才会赢!
此条目发表在 hbase 分类目录,贴了 标签。将固定链接加入收藏夹。

发表评论

电子邮件地址不会被公开。 必填项已用 * 标注

*

您可以使用这些 HTML 标签和属性: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>