From fc122459d9e97a97e62e9ddc1584d9aee24ed1f0 Mon Sep 17 00:00:00 2001 From: Michael Stack Date: Thu, 8 Nov 2018 10:56:59 -0800 Subject: [PATCH] HBASE-21458 Error: Could not find or load main class org.apache.hadoop.hbase.util.GetJavaProperty --- bin/hbase | 23 +++++++++++------------ 1 file changed, 11 insertions(+), 12 deletions(-) diff --git a/bin/hbase b/bin/hbase index 5c1352df82..f65097a069 100755 --- a/bin/hbase +++ b/bin/hbase @@ -180,20 +180,11 @@ if [ -d "$HBASE_HOME/hbase-server/target/hbase-webapps" ]; 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 avail, add Hadoop to the CLASSPATH and to the JAVA_LIBRARY_PATH # Allow this functionality to be disabled if [ "$HBASE_DISABLE_HADOOP_CLASSPATH_LOOKUP" != "true" ] ; then @@ -314,7 +305,15 @@ fi #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 - HADOOP_JAVA_LIBRARY_PATH=$(HADOOP_CLASSPATH="$CLASSPATH" "${HADOOP_IN_PATH}" \ + # 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${temporary_cp}" "${HADOOP_IN_PATH}" \ org.apache.hadoop.hbase.util.GetJavaProperty java.library.path) if [ -n "$HADOOP_JAVA_LIBRARY_PATH" ]; then JAVA_LIBRARY_PATH=$(append_path "${JAVA_LIBRARY_PATH}" "$HADOOP_JAVA_LIBRARY_PATH") -- 2.16.3