You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@gravitino.apache.org by yu...@apache.org on 2026/06/01 08:04:00 UTC
(gravitino) branch branch-1.3 updated: [Cherry-pick to branch-1.3] [#10330] improvement(bin): Output clear error message when Java is not found or version is unsupported (#11282) (#11313)
This is an automated email from the ASF dual-hosted git repository.
yuqi1129 pushed a commit to branch branch-1.3
in repository https://gitbox.apache.org/repos/asf/gravitino.git
The following commit(s) were added to refs/heads/branch-1.3 by this push:
new 04c28131dd [Cherry-pick to branch-1.3] [#10330] improvement(bin): Output clear error message when Java is not found or version is unsupported (#11282) (#11313)
04c28131dd is described below
commit 04c28131dd44ffa079507f9db7dc4fc6224abf5e
Author: github-actions[bot] <41...@users.noreply.github.com>
AuthorDate: Mon Jun 1 16:03:55 2026 +0800
[Cherry-pick to branch-1.3] [#10330] improvement(bin): Output clear error message when Java is not found or version is unsupported (#11282) (#11313)
**Cherry-pick Information:**
- Original commit: 036d1d5c28f6b7cbaf436610baefac18be6c90e5
- Target branch: `branch-1.3`
- Status: ✅ Clean cherry-pick (no conflicts)
Co-authored-by: Jerry Shao <je...@datastrato.com>
Co-authored-by: Claude Sonnet 4.6 <no...@anthropic.com>
---
bin/common.sh.template | 16 +++++++---------
bin/gravitino-iceberg-rest-server.sh.template | 2 +-
bin/gravitino-lance-rest-server.sh.template | 2 +-
bin/gravitino-optimizer.sh.template | 2 +-
bin/gravitino.sh.template | 2 +-
5 files changed, 11 insertions(+), 13 deletions(-)
diff --git a/bin/common.sh.template b/bin/common.sh.template
index a5de3bd38c..1f38dd38b8 100644
--- a/bin/common.sh.template
+++ b/bin/common.sh.template
@@ -58,23 +58,21 @@ function check_java_version() {
if [[ -n "${JAVA_HOME+x}" ]]; then
JAVA="$JAVA_HOME/bin/java"
fi
+ if ! command -v "${JAVA:-java}" > /dev/null 2>&1; then
+ echo "Error: Java not found. Please install Java 17 or newer and set JAVA_HOME or add java to PATH."
+ exit 1
+ fi
java_ver_output=$("${JAVA:-java}" -version 2>&1)
jvmver=$(echo "$java_ver_output" | grep '[openjdk|java] version' | awk -F'"' 'NR==1 {print $2}' | cut -d\- -f1)
JVM_VERSION=$(echo "$jvmver"|sed -e 's|^\([0-9][0-9]*\)\..*$|\1|')
- if [ "$JVM_VERSION" = "1" ]; then
+ if [[ "$JVM_VERSION" = "1" ]]; then
JVM_VERSION=$(echo "$jvmver"|sed -e 's|^1\.\([0-9][0-9]*\)\..*$|\1|')
fi
- if [ "$JVM_VERSION" -lt 8 ]; then
- echo "Gravitino requires either Java 8 or newer"
+ if [[ "$JVM_VERSION" -lt 17 ]]; then
+ echo "Error: Gravitino requires Java 17 or newer, but found Java ${JVM_VERSION}."
exit 1
fi
-
- # JDK 8u151 version fixed a number of security vulnerabilities and issues to improve system stability and security.
- # https://www.oracle.com/java/technologies/javase/8u151-relnotes.html
- if [[ "$JVM_VERSION" -eq 8 && "${jvmver#*_}" -lt 151 ]]; then
- echo "[WARNING] Gravitino highly recommends using either Java 8 update 151 or newer"
- fi
}
function addEachJarInDir(){
diff --git a/bin/gravitino-iceberg-rest-server.sh.template b/bin/gravitino-iceberg-rest-server.sh.template
index df26c3e812..2f375a462b 100755
--- a/bin/gravitino-iceberg-rest-server.sh.template
+++ b/bin/gravitino-iceberg-rest-server.sh.template
@@ -152,7 +152,7 @@ JAVA_OPTS+=" -Dlog4j2.configurationFile=file://${GRAVITINO_CONF_DIR}/gravitino-i
JAVA_OPTS+=" -Dgravitino.iceberg-rest-server.log.path=${GRAVITINO_LOG_DIR}"
JAVA_OPTS+=" -Dgravitino.iceberg-rest-server.name=${GRAVITINO_SIMPLE_SERVER_NAME}"
JAVA_OPTS+=" ${GRAVITINO_MEM}"
-if [ "$JVM_VERSION" -eq 17 ]; then
+if [[ "$JVM_VERSION" -eq 17 ]]; then
JAVA_OPTS+=" -XX:+IgnoreUnrecognizedVMOptions"
JAVA_OPTS+=" --add-opens java.base/java.io=ALL-UNNAMED"
JAVA_OPTS+=" --add-opens java.base/java.lang.invoke=ALL-UNNAMED"
diff --git a/bin/gravitino-lance-rest-server.sh.template b/bin/gravitino-lance-rest-server.sh.template
index 87f6f1deb4..c8812f0860 100644
--- a/bin/gravitino-lance-rest-server.sh.template
+++ b/bin/gravitino-lance-rest-server.sh.template
@@ -152,7 +152,7 @@ JAVA_OPTS+=" -Dlog4j2.configurationFile=file://${GRAVITINO_CONF_DIR}/gravitino-l
JAVA_OPTS+=" -Dgravitino.lance-rest-server.log.path=${GRAVITINO_LOG_DIR}"
JAVA_OPTS+=" -Dgravitino.lance-rest-server.name=${GRAVITINO_SIMPLE_SERVER_NAME}"
JAVA_OPTS+=" ${GRAVITINO_MEM}"
-if [ "$JVM_VERSION" -eq 17 ]; then
+if [[ "$JVM_VERSION" -eq 17 ]]; then
JAVA_OPTS+=" -XX:+IgnoreUnrecognizedVMOptions"
JAVA_OPTS+=" --add-opens java.base/java.io=ALL-UNNAMED"
JAVA_OPTS+=" --add-opens java.base/java.lang.invoke=ALL-UNNAMED"
diff --git a/bin/gravitino-optimizer.sh.template b/bin/gravitino-optimizer.sh.template
index d657cbbe03..d750abe0a1 100755
--- a/bin/gravitino-optimizer.sh.template
+++ b/bin/gravitino-optimizer.sh.template
@@ -50,7 +50,7 @@ JAVA_OPTS+=" -Dfile.encoding=UTF-8"
JAVA_OPTS+=" -Dlog4j2.configurationFile=file://${GRAVITINO_CONF_DIR}/log4j2.properties"
JAVA_OPTS+=" -Dgravitino.log.path=${GRAVITINO_LOG_DIR} ${GRAVITINO_MEM}"
JAVA_OPTS+=" -Dgravitino.server.name=${GRAVITINO_LOG_NAME}"
-if [ "$JVM_VERSION" -eq 17 ]; then
+if [[ "$JVM_VERSION" -eq 17 ]]; then
JAVA_OPTS+=" -XX:+IgnoreUnrecognizedVMOptions"
JAVA_OPTS+=" --add-opens java.base/java.io=ALL-UNNAMED"
JAVA_OPTS+=" --add-opens java.base/java.lang.invoke=ALL-UNNAMED"
diff --git a/bin/gravitino.sh.template b/bin/gravitino.sh.template
index 1ba2692cb6..11c698d864 100755
--- a/bin/gravitino.sh.template
+++ b/bin/gravitino.sh.template
@@ -153,7 +153,7 @@ JAVA_OPTS+=" -Dgravitino.log.path=${GRAVITINO_LOG_DIR}"
JAVA_OPTS+=" -Dgravitino.server.name=${GRAVITINO_SIMPLE_SERVER_NAME}"
JAVA_OPTS+=" ${GRAVITINO_MEM}"
-if [ "$JVM_VERSION" -eq 17 ]; then
+if [[ "$JVM_VERSION" -eq 17 ]]; then
JAVA_OPTS+=" -XX:+IgnoreUnrecognizedVMOptions"
JAVA_OPTS+=" --add-opens java.base/java.io=ALL-UNNAMED"
JAVA_OPTS+=" --add-opens java.base/java.lang.invoke=ALL-UNNAMED"