HBASE-5286 bin/hbase's logic of adding Hadoop jar files to the classpath is fragile when presented with split packaged Hadoop 0.23 installation
git-svn-id: https://svn.apache.org/repos/asf/hbase/trunk@1296661 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
4343a0a00d
commit
180b41f518
31
bin/hbase
31
bin/hbase
|
@ -217,31 +217,14 @@ function append_path() {
|
||||||
JAVA_PLATFORM=""
|
JAVA_PLATFORM=""
|
||||||
|
|
||||||
#If avail, add Hadoop to the CLASSPATH and to the JAVA_LIBRARY_PATH
|
#If avail, add Hadoop to the CLASSPATH and to the JAVA_LIBRARY_PATH
|
||||||
if [ ! -z $HADOOP_HOME ]; then
|
HADOOP_IN_PATH=$(PATH="${HADOOP_HOME:-${HADOOP_PREFIX}}/bin:$PATH" which hadoop 2>/dev/null)
|
||||||
HADOOPCPPATH=""
|
if [ -f ${HADOOP_IN_PATH} ]; then
|
||||||
if [ -z $HADOOP_CONF_DIR ]; then
|
HADOOP_JAVA_LIBRARY_PATH=$(HADOOP_CLASSPATH="$CLASSPATH" ${HADOOP_IN_PATH} \
|
||||||
HADOOPCPPATH=$(append_path "${HADOOPCPPATH}" "${HADOOP_HOME}/conf")
|
org.apache.hadoop.hbase.util.GetJavaProperty java.library.path 2>/dev/null)
|
||||||
else
|
if [ -n "$HADOOP_JAVA_LIBRARY_PATH" ]; then
|
||||||
HADOOPCPPATH=$(append_path "${HADOOPCPPATH}" "${HADOOP_CONF_DIR}")
|
JAVA_LIBRARY_PATH=$(append_path "${JAVA_LIBRARY_PATH}" "$HADOOP_JAVA_LIBRARY_PATH")
|
||||||
fi
|
|
||||||
if [ "`echo ${HADOOP_HOME}/hadoop-core*.jar`" != "${HADOOP_HOME}/hadoop-core*.jar" ] ; then
|
|
||||||
HADOOPCPPATH=$(append_path "${HADOOPCPPATH}" `ls ${HADOOP_HOME}/hadoop-core*.jar | head -1`)
|
|
||||||
else
|
|
||||||
HADOOPCPPATH=$(append_path "${HADOOPCPPATH}" `ls ${HADOOP_HOME}/hadoop-common*.jar | head -1`)
|
|
||||||
HADOOPCPPATH=$(append_path "${HADOOPCPPATH}" `ls ${HADOOP_HOME}/hadoop-hdfs*.jar | head -1`)
|
|
||||||
HADOOPCPPATH=$(append_path "${HADOOPCPPATH}" `ls ${HADOOP_HOME}/hadoop-mapred*.jar | head -1`)
|
|
||||||
fi
|
|
||||||
for i in "${HADOOP_HOME}/lib/"*.jar; do
|
|
||||||
HADOOPCPPATH="${HADOOPCPPATH}:$i"
|
|
||||||
done
|
|
||||||
CLASSPATH=$(append_path "${CLASSPATH}" "${HADOOPCPPATH}")
|
|
||||||
|
|
||||||
if [ -d "${HADOOP_HOME}/lib/native" ]; then
|
|
||||||
JAVA_PLATFORM=`CLASSPATH=${HADOOPCPPATH} ${JAVA} org.apache.hadoop.util.PlatformName | sed -e "s/ /_/g"`
|
|
||||||
if [ -d "${HADOOP_HOME}/lib/native/${JAVA_PLATFORM}" ]; then
|
|
||||||
JAVA_LIBRARY_PATH=$(append_path "${JAVA_LIBRARY_PATH}" "${HADOOP_HOME}/lib/native/${JAVA_PLATFORM}")
|
|
||||||
fi
|
|
||||||
fi
|
fi
|
||||||
|
CLASSPATH=$(append_path "${CLASSPATH}" `${HADOOP_IN_PATH} classpath 2>/dev/null`)
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [ -d "${HBASE_HOME}/build/native" -o -d "${HBASE_HOME}/lib/native" ]; then
|
if [ -d "${HBASE_HOME}/build/native" -o -d "${HBASE_HOME}/lib/native" ]; then
|
||||||
|
|
Loading…
Reference in New Issue