展开
拓展 关闭
订阅号推广码
GitHub
视频
公告栏 关闭

报错:org.apache.hadoop.hbase.util.GetJavaProperty

  • hbase和flume查看版本时显示如下
[root@slave1 flume-1.9.0]# hbase version  
错误: 找不到或无法加载主类 org.apache.hadoop.hbase.util.GetJavaProperty
SLF4J: Class path contains multiple SLF4J bindings.
SLF4J: Found binding in [jar:file:/usr/local/software/hadoop-2.9.2/share/hadoop/common/lib/slf4j-log4j12-1.7.25.jar!/org/slf4j/impl/StaticLoggerBinder.class]
SLF4J: Found binding in [jar:file:/usr/local/software/hbase-2.1.0/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.1.0
Source code repository git://zhangduo-Gen8/home/zhangduo/hbase/code revision=e1673bb0bbfea21d6e5dba73e013b09b8b49b89b
Compiled by zhangduo on Tue Jul 10 17:26:48 CST 2018
From source with checksum c8fb98abf2988c0490954e15806337d7

[root@slave1 flume-1.9.0]# flume-ng version
错误: 找不到或无法加载主类 org.apache.hadoop.hbase.util.GetJavaProperty
Flume 1.9.0
Source code repository: https://git-wip-us.apache.org/repos/asf/flume.git
Revision: d4fcab4f501d41597bc616921329a4339f73585e
Compiled by fszabo on Mon Dec 17 20:45:25 CET 2018
From source with checksum 35db629a3bda49d23e9b3690c80737f9
  • 解决方案
# 添加1行:add_to_cp_if_exists "${HBASE_HOME}/hbase-server/target/classes"
#add if we are in a dev environment
if [ -d "$HBASE_HOME/hbase-server/target/hbase-webapps" ]; then
  if [ "$COMMAND" = "thrift" ] ; then
    add_to_cp_if_exists "${HBASE_HOME}/hbase-thrift/target"
  elif [ "$COMMAND" = "thrift2" ] ; then
    add_to_cp_if_exists "${HBASE_HOME}/hbase-thrift/target"
  elif [ "$COMMAND" = "rest" ] ; then
    add_to_cp_if_exists "${HBASE_HOME}/hbase-rest/target"
  else
    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"
  fi
fi

# 注释如下
#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 configured and available, add Hadoop to the CLASSPATH and to the JAVA_LIBRARY_PATH
if [ -n "${HADOOP_IN_PATH}" ] && [ -f "${HADOOP_IN_PATH}" ]; then
# 添加如下8行
  # 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

# 注释并添加如下1行
#  HADOOP_JAVA_LIBRARY_PATH=$(HADOOP_CLASSPATH="$CLASSPATH" "${HADOOP_IN_PATH}" \
  HADOOP_JAVA_LIBRARY_PATH=$(HADOOP_CLASSPATH="$CLASSPATH${temporary_cp}" "${HADOOP_IN_PATH}" \
  • 重启hbase
# slave1输入
start-hbase.sh

# 再次查看hbase和flume版本显示正常
posted @ 2023-12-19 14:38  DogLeftover  阅读(190)  评论(0编辑  收藏  举报