This is an automated email from the ASF dual-hosted git repository.
difin pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/hive.git
The following commit(s) were added to refs/heads/master by this push:
new 9032a259b3f Hive-29661: SLF4J multi-binding fix for beeline start
(#6540)
9032a259b3f is described below
commit 9032a259b3f543542976bd0e3d4f0d5d41815524
Author: Attila Turoczy <[email protected]>
AuthorDate: Fri Jul 3 23:37:29 2026 +0200
Hive-29661: SLF4J multi-binding fix for beeline start (#6540)
* HIVE-29661: SLF4J multi-binding fix for beeline start
* HIVE-29661: Dedup beelineClasspath entries from hadoop classpath --glob
beelineClasspath is seeded from HADOOP_CLASSPATH, then extended with
every entry from `hadoop classpath --glob`. Hadoop's own startup builds
that glob from HADOOP_CLASSPATH plus its own jars/confs, so the two
overlap and the same jar would land on the classpath twice. Add a
literal-string substring guard before each append to skip entries
already present; wrap both haystack and needle in `:` so the match is
position-safe and partial-name jars (e.g. `b` inside `ab`) don't
spuriously match.
---
bin/ext/beeline.sh | 34 ++++++++++++++++++++++++++++++++--
1 file changed, 32 insertions(+), 2 deletions(-)
diff --git a/bin/ext/beeline.sh b/bin/ext/beeline.sh
index e61897e4cb6..3be45b50135 100644
--- a/bin/ext/beeline.sh
+++ b/bin/ext/beeline.sh
@@ -32,11 +32,41 @@ beeline () {
export HADOOP_CLIENT_OPTS="$HADOOP_CLIENT_OPTS
-Dlog4j.configurationFile=beeline-log4j2.properties --add-opens
java.base/java.nio=ALL-UNNAMED --add-opens java.base/java.net=ALL-UNNAMED
--add-opens java.base/java.lang=ALL-UNNAMED --add-opens
java.base/java.util=ALL-UNNAMED --add-opens
java.base/java.util.concurrent=ALL-UNNAMED --add-opens
java.base/java.util.concurrent.atomic=ALL-UNNAMED --add-opens
java.base/java.util.regex=ALL-UNNAMED --add-opens
java.base/java.lang.reflect=ALL-UNNAM [...]
if [ "$EXECUTE_WITH_JAVA" != "true" ] ; then
+ if [ "$BEELINE_USE_HADOOP_JAR" == "true" ] ; then
+ if [ -z $CLIUSER ] ; then
+ exec $HADOOP jar ${beelineJarPath} $CLASS $HIVE_OPTS "$@"
+ else
+ exec $HADOOP jar ${beelineJarPath} $CLASS $HIVE_OPTS "$@" -n
"${CLIUSER}" -p "${CLIUSER}"
+ fi
+ fi
+ beelineClasspath="${HADOOP_CLASSPATH}"
+ for x in $(${HADOOP} classpath --glob 2>/dev/null | tr ':' '\n') ; do
+ case "$x" in
+ *slf4j-reload4j*|*slf4j-log4j12*|*log4j-1.2*|*reload4j*) continue ;;
+ esac
+ # `hadoop classpath --glob` already covers everything HADOOP_CLASSPATH
adds, so
+ # skip entries we have seen — otherwise the same jar lands on the
classpath twice.
+ if [[ ":${beelineClasspath}:" == *":${x}:"* ]]
+ then
+ continue
+ fi
+ beelineClasspath="${beelineClasspath}:${x}"
+ done
+ # JAVAEXE is only set by bin/hive on the no-Hadoop fallback path, so
resolve
+ # the java binary here for the common case where HADOOP_HOME is present.
+ beelineJava="${JAVAEXE}"
+ if [ -z "$beelineJava" ] ; then
+ if [ -n "$JAVA_HOME" ] && [ -x "$JAVA_HOME/bin/java" ] ; then
+ beelineJava="$JAVA_HOME/bin/java"
+ else
+ beelineJava="java"
+ fi
+ fi
# if CLIUSER is not empty, then pass it as user id / password during
beeline redirect
if [ -z $CLIUSER ] ; then
- exec $HADOOP jar ${beelineJarPath} $CLASS $HIVE_OPTS "$@"
+ exec "$beelineJava" $HADOOP_CLIENT_OPTS -cp "${beelineClasspath}" $CLASS
$HIVE_OPTS "$@"
else
- exec $HADOOP jar ${beelineJarPath} $CLASS $HIVE_OPTS "$@" -n
"${CLIUSER}" -p "${CLIUSER}"
+ exec "$beelineJava" $HADOOP_CLIENT_OPTS -cp "${beelineClasspath}" $CLASS
$HIVE_OPTS "$@" -n "${CLIUSER}" -p "${CLIUSER}"
fi
else
# if CLIUSER is not empty, then pass it as user id / password during
beeline redirect