问题描述:
验证Hbase是否安装成功时爆出一大堆信息:
/usr/local/hadoop/libexec/hadoop-functions.sh: 行 2360: HADOOP_ORG.APACHE.HADOOP.HBASE.UTIL.GETJAVAPROPERTY_USER:错误的替换 /usr/local/hadoop/libexec/hadoop-functions.sh: 行 2455: HADOOP_ORG.APACHE.HADOOP.HBASE.UTIL.GETJAVAPROPERTY_OPTS:错误的替换 错误: 找不到或无法加载主类 org.apache.hadoop.hbase.util.GetJavaProperty SLF4J: Class path contains multiple SLF4J bindings. SLF4J: Found binding in [jar:file:/usr/local/hadoop/share/hadoop/common/lib/slf4j-log4j12-1.7.25.jar!/org/slf4j/impl/StaticLoggerBinder.class] SLF4J: Found binding in [jar:file:/usr/local/hbase/lib/client-facing-thirdparty/slf4j-log4j12-1.7.25.jar!/org/slf4j/impl/StaticLoggerBinder.class] SLF4J: See http://www.slf4j.org/codes.html#multiple_bindings for an explanation. SLF4J: Actual binding is of type [org.slf4j.impl.Log4jLoggerFactory] HBase 2.2.2 Source code repository git://6ad68c41b902/opt/hbase-rm/output/hbase revision=e6513a76c91cceda95dad7af246ac81d46fa2589 Compiled by hbase-rm on Sat Oct 19 10:10:12 UTC 2019 From source with checksum 4d23f97701e395c5d34db1882ac5021b
解决方式一:修改 hbase-env.sh 文件(hbase-env.sh 在 hbase 安装目录下的 /usr/local/hbase/conf 目录下)
将hbase-env.sh 文件 最后一句:前面的注释去掉。(先到该目录,然后右键该目录,用vim打开)
解决方式二:如果问题还没有得到解决:例如还有一些问题:
(1)“找不到或无法加载主类”的问题:org.apach.hadoop.habase.util.GetJavaProperty
/usr/local/hadoop/bin../libexec/hadoop-functions.sh行HADOOP._ORG.APACHE.HADOOP.HBASE.UTIL.GETJAVAPROPERTY_USER:错误的替换。
解决:修改hbase安装目录下 /bin/目录下的hbase文件:(先到该目录,然后右键该目录,用vim打开)
① 在add_to_cp_if_exists “${HBASE_HOME}/hbase-server/target” 下添加:
# Needed for GetJavaProperty check below add_to_cp_if_exists "${HBASE_HOME}/hbase-server/target/classes"
② 将以下代码注释掉:
#add the hbase jars for each module for f in $HBASE_HOME/hbase-jars/hbase*.jar; do if [[ $f = *sources.jar ]] then : # Skip sources.jar elif [ -f $f ] then CLASSPATH=${CLASSPATH}:$f; fi done
③ 在if [ -n "{HADOOP_IN_PATH}" ] && [ -f "{HADOOP_IN_PATH}" ] && [ -f "{HADOOP_IN_PATH}" ]; then 下添加:
# If built hbase, temporarily add hbase-server*.jar to classpath for GetJavaProperty # Exclude hbase-server*-tests.jar temporary_cp= for f in "${HBASE_HOME}"/lib/hbase-server*.jar; do if [[ ! "${f}" =~ ^.*\-tests\.jar$ ]]; then temporary_cp=":$f" fi done
④ 修改:HADOOP_JAVA_LIBRARY_PATH=$(HADOOP_CLASSPATH="$CLASSPATH" "${HADOOP_IN_PATH}" \
为:
HADOOP_JAVA_LIBRARY_PATH=$(HADOOP_CLASSPATH="$CLASSPATH${temporary_cp}" "${HADOOP_IN_PATH}" \
然后保存并退出。
(2)SLF4J 的问题:Class path contains multiple SLF4J bindings.
原因:路径中含有冲突的jar包,如下图所示,一个在hbase路径下另一个在hadoop路径下。
解决:将HBase 或 Hadoop 目录下的 slf4j-logj12-1.7.25.jar, 其中一个改一下,
例如修改 HBase目录下的 slf4j-logj12-1.7.25.jar 为:slf4j-logj12-1.7.25.jar-copy (右键搜索到的文件 -》 重命名)
(3)现在还有问题:HADOOP_ORG.APACHE.HADOOP.HBASE.UTIL.GETJAVAPROPERTY_USER: 错误的替换
解决:直接忽视