goutamadwant commented on code in PR #11545:
URL: https://github.com/apache/seatunnel/pull/11545#discussion_r4215295800
##########
seatunnel-core/seatunnel-starter/src/main/bin/seatunnel.sh:
##########
@@ -109,6 +109,32 @@ do
fi
done
+# SeaTunnel requires Java 11 or newer. Fail fast with an actionable message
instead of letting a
+# JDK 8 launcher abort on the JDK 9+ module flags below with a cryptic
"Unrecognized option" error.
+JAVA_MAJOR_VERSION=$(java -version 2>&1 | awk -F '[".]' '/version/ {print ($2
== "1") ? $3 : $2; exit}')
+if [[ -n "$JAVA_MAJOR_VERSION" && "$JAVA_MAJOR_VERSION" -lt 11 ]]; then
+ echo "Error: SeaTunnel requires Java 11 or newer, but Java
${JAVA_MAJOR_VERSION} was detected. Point JAVA_HOME/PATH at a Java 11+ JDK." >&2
+ exit 1
+fi
+
+# These JDK module flags are mandatory on Java 11+: Hazelcast needs reflective
access to JDK
+# internals and the Kerberos krb5.conf reload needs the jgss export. They are
appended here, not
+# only shipped in the config/jvm_*_options templates, so an in-place upgrade
that preserves an old
+# config directory (mounted Docker volume, K8s ConfigMap) cannot silently drop
them. Appending a
+# flag twice is harmless, so config files that already carry them stay
compatible.
+for module_flag in \
+ "--add-opens=java.base/java.lang=ALL-UNNAMED" \
+ "--add-opens=java.base/java.net=ALL-UNNAMED" \
+ "--add-opens=java.base/java.nio=ALL-UNNAMED" \
Review Comment:
Could we add the same fallback to `seatunnel.cmd` and
`seatunnel-cluster.cmd`? Both Windows launchers still get these flags only from
configuration or `JvmOption`. Upgrading to Java 17 while keeping the existing
`jvm_*_options` therefore misses the protection added here.
This affects ordinary Doris and StarRocks source reads. At `74ac922d6`, I
passed one valid INT row through their shared `ArrowToSeatunnelRowReader`: Java
11 read it without flags; Java 17 failed in `loadNextBatch()` because
`java.nio.Buffer.address` was inaccessible; adding only
`--add-opens=java.base/java.nio=ALL-UNNAMED` made the same read pass. This
reproduces the Java read path; the Windows launcher gap is verified from
source, not a Windows end-to-end run.
Please append the missing flags in both batch launchers as well, so Windows
users can retain their existing configuration when following the Java 17
migration instructions.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]