You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@hbase.apache.org by el...@apache.org on 2018/03/14 19:56:05 UTC

[3/3] hbase git commit: HBASE-20187 Shell startup fails with IncompatibleClassChangeError

HBASE-20187 Shell startup fails with IncompatibleClassChangeError

Signed-off-by: Josh Elser <el...@apache.org>


Project: http://git-wip-us.apache.org/repos/asf/hbase/repo
Commit: http://git-wip-us.apache.org/repos/asf/hbase/commit/67a304d3
Tree: http://git-wip-us.apache.org/repos/asf/hbase/tree/67a304d3
Diff: http://git-wip-us.apache.org/repos/asf/hbase/diff/67a304d3

Branch: refs/heads/master
Commit: 67a304d39f3e53553896f868ed2f5b8c622cc675
Parents: f63a7ff
Author: Balazs Meszaros <ba...@cloudera.com>
Authored: Tue Mar 13 16:38:46 2018 +0100
Committer: Josh Elser <el...@apache.org>
Committed: Wed Mar 14 15:55:33 2018 -0400

----------------------------------------------------------------------
 bin/hbase              | 55 +++++++++++++++++++++++++--------------------
 hbase-assembly/pom.xml | 19 ++++++++++++----
 2 files changed, 46 insertions(+), 28 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/hbase/blob/67a304d3/bin/hbase
----------------------------------------------------------------------
diff --git a/bin/hbase b/bin/hbase
index 53c47ee..8dfa16a 100755
--- a/bin/hbase
+++ b/bin/hbase
@@ -171,22 +171,6 @@ if [ -d "$HBASE_HOME/hbase-server/target/hbase-webapps" ]; then
   fi
 fi
 
-add_maven_deps_to_classpath() {
-  f="${HBASE_HOME}/hbase-build-configuration/target/cached_classpath.txt"
-  if [ ! -f "${f}" ]
-  then
-      echo "As this is a development environment, we need ${f} to be generated from maven (command: mvn install -DskipTests)"
-      exit 1
-  fi
-  CLASSPATH=${CLASSPATH}:`cat "${f}"`
-}
-
-
-#Add the development env class path stuff
-if $in_dev_env; then
-  add_maven_deps_to_classpath
-fi
-
 #add the hbase jars for each module
 for f in $HBASE_HOME/hbase-jars/hbase*.jar; do
 	if [[ $f = *sources.jar ]]
@@ -301,6 +285,15 @@ if [ "$AUTH_AS_SERVER" == "true" ] || [ "$COMMAND" = "hbck" ]; then
    fi
 fi
 
+# check if the command needs jline
+declare -a jline_cmds=("zkcli" "org.apache.hadoop.hbase.zookeeper.ZKMainServer")
+for cmd in "${jline_cmds[@]}"; do
+  if [[ $cmd == "$COMMAND" ]]; then
+    jline_needed=true
+    break
+  fi
+done
+
 # for jruby
 # (1) for the commands which need jruby (see jruby_cmds defined below)
 #     A. when JRUBY_HOME is specified explicitly, eg. export JRUBY_HOME=/usr/local/share/jruby
@@ -318,6 +311,27 @@ for cmd in "${jruby_cmds[@]}"; do
   fi
 done
 
+add_maven_deps_to_classpath() {
+  f="${HBASE_HOME}/hbase-build-configuration/target/$1"
+
+  if [ ! -f "${f}" ]; then
+      echo "As this is a development environment, we need ${f} to be generated from maven (command: mvn install -DskipTests)"
+      exit 1
+  fi
+  CLASSPATH=${CLASSPATH}:$(cat "${f}")
+}
+
+#Add the development env class path stuff
+if $in_dev_env; then
+  add_maven_deps_to_classpath "cached_classpath.txt"
+
+  if [[ $jline_needed ]]; then
+    add_maven_deps_to_classpath "cached_classpath_jline.txt"
+  elif [[ $jruby_needed ]]; then
+    add_maven_deps_to_classpath "cached_classpath_jruby.txt"
+  fi
+fi
+
 # the command needs jruby
 if [[ $jruby_needed ]]; then
   if [ "$JRUBY_HOME" != "" ]; then  # JRUBY_HOME is specified explicitly, eg. export JRUBY_HOME=/usr/local/share/jruby
@@ -328,14 +342,7 @@ if [[ $jruby_needed ]]; then
     HBASE_OPTS="$HBASE_OPTS -Djruby.home=$JRUBY_HOME -Djruby.lib=$JRUBY_HOME/lib"
 
   else  # JRUBY_HOME is not specified explicitly
-    if $in_dev_env; then  # in dev environment
-      F_JRUBY="${HBASE_HOME}/hbase-build-configuration/target/cached_classpath_jruby.txt"
-      if [ ! -f "${F_JRUBY}" ]; then
-        echo "As this is a development environment, we need ${F_JRUBY} to be generated from maven (command: mvn install -DskipTests)"
-        exit 1
-      fi
-      CLASSPATH=$(cat "${F_JRUBY}"):$CLASSPATH;
-    else  # not in dev environment
+    if ! $in_dev_env; then  # not in dev environment
       # add jruby packaged with HBase to CLASSPATH
       JRUBY_PACKAGED_WITH_HBASE="$HBASE_HOME/lib/ruby/*.jar"
       for jruby_jar in $JRUBY_PACKAGED_WITH_HBASE; do

http://git-wip-us.apache.org/repos/asf/hbase/blob/67a304d3/hbase-assembly/pom.xml
----------------------------------------------------------------------
diff --git a/hbase-assembly/pom.xml b/hbase-assembly/pom.xml
index bcefa0a..5da105b 100644
--- a/hbase-assembly/pom.xml
+++ b/hbase-assembly/pom.xml
@@ -110,14 +110,25 @@
             </goals>
             <configuration>
               <outputFile>${project.parent.basedir}/target/cached_classpath.txt</outputFile>
-              <excludeArtifactIds>jruby-complete</excludeArtifactIds>
+              <excludeArtifactIds>jline,jruby-complete</excludeArtifactIds>
             </configuration>
           </execution>
 
           <execution>
-            <!-- Generates a file containing jruby jar.
-                 In dev environment, bin/hbase will read the file and add the jar into classpath when jruby is needed
-            -->
+            <!-- generates the file that will be used by the bin/hbase zkcli script in the dev env -->
+            <id>create-hbase-generated-classpath-jline</id>
+            <phase>test</phase>
+            <goals>
+              <goal>build-classpath</goal>
+            </goals>
+            <configuration>
+              <outputFile>${project.parent.basedir}/target/cached_classpath_jline.txt</outputFile>
+              <includeArtifactIds>jline</includeArtifactIds>
+            </configuration>
+          </execution>
+
+          <execution>
+            <!-- generates the file that will be used by the bin/hbase shell script in the dev env -->
             <id>create-hbase-generated-classpath-jruby</id>
             <phase>test</phase>
             <goals>