From 95cce5835e897ac392fe5ff9bb4319413022c6e5 Mon Sep 17 00:00:00 2001 From: Aireed Date: Sun, 20 Sep 2026 15:06:18 +0800 Subject: [PATCH 1/3] fix# 4384 add jdk version check and add more add-opens --- dist/src/main/amoro-bin/bin/ams.sh | 5 +++++ dist/src/main/amoro-bin/bin/load-config.sh | 12 ++++++++++++ 2 files changed, 17 insertions(+) diff --git a/dist/src/main/amoro-bin/bin/ams.sh b/dist/src/main/amoro-bin/bin/ams.sh index c4ee2eb098..3bff5d6c4c 100644 --- a/dist/src/main/amoro-bin/bin/ams.sh +++ b/dist/src/main/amoro-bin/bin/ams.sh @@ -43,6 +43,11 @@ JAVA_OPTS="-server -XX:+UseG1GC -XX:MaxGCPauseMillis=200 \ --add-opens=java.base/sun.util.calendar=ALL-UNNAMED \ " +# add krb5 module when jdk > 17 +if [ "$JAVA_MAJOR" -ge 17 ] 2>/dev/null; then + JAVA_OPTS="$JAVA_OPTS --add-opens=java.security.jgss/sun.security.krb5=ALL-UNNAMED" +fi + if [ -n "$JMX_REMOTE_PORT_CONFIG" ];then JAVA_OPTS="${JAVA_OPTS} -Dcom.sun.management.jmxremote.port=${JMX_REMOTE_PORT_CONFIG} \ -Dcom.sun.management.jmxremote \ diff --git a/dist/src/main/amoro-bin/bin/load-config.sh b/dist/src/main/amoro-bin/bin/load-config.sh index 69dc954621..d786003db4 100644 --- a/dist/src/main/amoro-bin/bin/load-config.sh +++ b/dist/src/main/amoro-bin/bin/load-config.sh @@ -17,6 +17,18 @@ # limitations under the License. # +get_java_major_version() { + local version=$(java -version 2>&1 | head -1 | cut -d'"' -f2) + if [[ "$version" == 1.* ]]; then + # JDK 8- 1.8.0_xxx → 8 + echo "$version" | cut -d'.' -f2 + else + # JDK 9+:11.0.x → 11, 17.0.x → 17 + echo "$version" | cut -d'.' -f1 + fi +} + +JAVA_MAJOR=$(get_java_major_version) CURRENT_DIR="$( cd "$(dirname "$0")" ; pwd -P )" AMORO_HOME="$( cd "$CURRENT_DIR/../" ; pwd -P )" From 3fe7276c51aedf7b6357716558f723b2d0a8fecc Mon Sep 17 00:00:00 2001 From: Aireed Date: Sun, 20 Sep 2026 15:10:20 +0800 Subject: [PATCH 2/3] fix --- dist/src/main/amoro-bin/bin/ams.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/dist/src/main/amoro-bin/bin/ams.sh b/dist/src/main/amoro-bin/bin/ams.sh index 3bff5d6c4c..19c9d9ae08 100644 --- a/dist/src/main/amoro-bin/bin/ams.sh +++ b/dist/src/main/amoro-bin/bin/ams.sh @@ -45,7 +45,7 @@ JAVA_OPTS="-server -XX:+UseG1GC -XX:MaxGCPauseMillis=200 \ # add krb5 module when jdk > 17 if [ "$JAVA_MAJOR" -ge 17 ] 2>/dev/null; then - JAVA_OPTS="$JAVA_OPTS --add-opens=java.security.jgss/sun.security.krb5=ALL-UNNAMED" + JAVA_OPTS="${JAVA_OPTS} --add-opens=java.security.jgss/sun.security.krb5=ALL-UNNAMED" fi if [ -n "$JMX_REMOTE_PORT_CONFIG" ];then From faf85405dc40c99d62752eb1d34847b7467d1a81 Mon Sep 17 00:00:00 2001 From: Aireed Date: Tue, 22 Sep 2026 10:57:04 +0800 Subject: [PATCH 3/3] fix according to the comment --- dist/src/main/amoro-bin/bin/load-config.sh | 26 +++++++++++----------- 1 file changed, 13 insertions(+), 13 deletions(-) diff --git a/dist/src/main/amoro-bin/bin/load-config.sh b/dist/src/main/amoro-bin/bin/load-config.sh index d786003db4..10cce34319 100644 --- a/dist/src/main/amoro-bin/bin/load-config.sh +++ b/dist/src/main/amoro-bin/bin/load-config.sh @@ -17,19 +17,6 @@ # limitations under the License. # -get_java_major_version() { - local version=$(java -version 2>&1 | head -1 | cut -d'"' -f2) - if [[ "$version" == 1.* ]]; then - # JDK 8- 1.8.0_xxx → 8 - echo "$version" | cut -d'.' -f2 - else - # JDK 9+:11.0.x → 11, 17.0.x → 17 - echo "$version" | cut -d'.' -f1 - fi -} - -JAVA_MAJOR=$(get_java_major_version) - CURRENT_DIR="$( cd "$(dirname "$0")" ; pwd -P )" AMORO_HOME="$( cd "$CURRENT_DIR/../" ; pwd -P )" export AMORO_HOME @@ -96,3 +83,16 @@ fi if [ -n "${HIVE_CONF_DIR}" ]; then export AMORO_ADDITION_CLASSPATH=${AMORO_ADDITION_CLASSPATH}:${HIVE_CONF_DIR} fi + +get_java_major_version() { + local version=$($JAVA_RUN -version 2>&1 | head -1 | cut -d'"' -f2) + if [[ "$version" == 1.* ]]; then + # JDK 8- 1.8.0_xxx → 8 + echo "$version" | cut -d'.' -f2 + else + # JDK 9+:11.0.x → 11, 17.0.x → 17 + echo "$version" | cut -d'.' -f1 + fi +} + +JAVA_MAJOR=$(get_java_major_version)