You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@hbase.apache.org by bu...@apache.org on 2019/11/06 05:11:34 UTC

[hbase] branch branch-2 updated: HBASE-21458 Error: Could not find or load main class org.apache.hadoop.hbase.util.GetJavaProperty

This is an automated email from the ASF dual-hosted git repository.

busbey pushed a commit to branch branch-2
in repository https://gitbox.apache.org/repos/asf/hbase.git


The following commit(s) were added to refs/heads/branch-2 by this push:
     new ea20bb3  HBASE-21458 Error: Could not find or load main class org.apache.hadoop.hbase.util.GetJavaProperty
ea20bb3 is described below

commit ea20bb35be73be86e578a64960688842b7a98665
Author: Michael Stack <st...@apache.org>
AuthorDate: Thu Nov 8 10:56:59 2018 -0800

    HBASE-21458 Error: Could not find or load main class org.apache.hadoop.hbase.util.GetJavaProperty
    
    Signed-off-by: Sean Busbey <bu...@apache.org>
---
 bin/hbase | 23 +++++++++++------------
 1 file changed, 11 insertions(+), 12 deletions(-)

diff --git a/bin/hbase b/bin/hbase
index 86a9165..e19fd1d 100755
--- a/bin/hbase
+++ b/bin/hbase
@@ -182,20 +182,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
@@ -316,7 +307,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")