This is an automated email from the ASF dual-hosted git repository.

jungm pushed a commit to branch ee11
in repository https://gitbox.apache.org/repos/asf/tomee-tck.git


The following commit(s) were added to refs/heads/ee11 by this push:
     new a6e6b3b  Ensure JAVA_HOME is set for the security runner's bundled 
provider
a6e6b3b is described below

commit a6e6b3bc8da40f6c6d392b806a25e3aa4eadb687
Author: Markus Jung <[email protected]>
AuthorDate: Thu Jul 23 21:29:36 2026 +0200

    Ensure JAVA_HOME is set for the security runner's bundled provider
    
    The security runner starts its bundled OpenID provider via Tomcat's
    startup.sh, which reads JAVA_HOME/JRE_HOME and ignores PATH. When both
    are unset the provider never starts (Maven still runs, since java is on
    PATH), the client's .well-known discovery fetch is refused, and the
    OpenId2Default/OpenId3Default TCK tests fail in a way that looks like a
    token-validation bug in TomEE.
    
    Derive JAVA_HOME from the java on PATH (resolving symlinks) when neither
    JAVA_HOME nor JRE_HOME is set, so the child JVMs launched by the
    provider's shell scripts inherit it; fail fast with a clear message when
    no java is found.
---
 runner-standalone/run-standalone-suite.sh | 26 ++++++++++++++++++++++++++
 1 file changed, 26 insertions(+)

diff --git a/runner-standalone/run-standalone-suite.sh 
b/runner-standalone/run-standalone-suite.sh
index 18e69db..a9aaf6e 100755
--- a/runner-standalone/run-standalone-suite.sh
+++ b/runner-standalone/run-standalone-suite.sh
@@ -30,6 +30,32 @@ ROOT_DIR=$(CDPATH= cd -- "$SCRIPT_DIR/.." && pwd)
 ID=${1:-}
 TOMEE_CLASSIFIER=${TOMEE_CLASSIFIER:-plume}
 
+# The security runner starts its bundled OpenID provider through Tomcat's
+# startup.sh, which reads JAVA_HOME/JRE_HOME directly and ignores PATH. When
+# neither is set (Maven still runs, since java is on PATH), the provider never
+# comes up, the client's .well-known fetch is refused, and the OpenID tests
+# fail in a way that looks like a token-validation bug. Derive JAVA_HOME from
+# the java on PATH so the child JVMs launched by shell scripts inherit it.
+if [ -z "${JAVA_HOME:-}" ] && [ -z "${JRE_HOME:-}" ]; then
+  if JAVA_BIN=$(command -v java 2>/dev/null) && [ -n "$JAVA_BIN" ]; then
+    JAVA_BIN=$(cd -- "$(dirname -- "$JAVA_BIN")" && pwd -P)/$(basename -- 
"$JAVA_BIN")
+    while [ -h "$JAVA_BIN" ]; do
+      LINK=$(readlink "$JAVA_BIN")
+      case $LINK in
+        /*) JAVA_BIN=$LINK ;;
+        *)  JAVA_BIN=$(cd -- "$(dirname -- "$JAVA_BIN")" && cd -- "$(dirname 
-- "$LINK")" && pwd -P)/$(basename -- "$LINK") ;;
+      esac
+    done
+    JAVA_HOME=$(cd -- "$(dirname -- "$JAVA_BIN")/.." && pwd -P)
+    export JAVA_HOME
+    echo "run-standalone-suite: JAVA_HOME was unset; using $JAVA_HOME (from 
java on PATH)" >&2
+  else
+    echo "run-standalone-suite: ERROR: JAVA_HOME/JRE_HOME are unset and no 
java found on PATH." >&2
+    echo "run-standalone-suite: the security runner's bundled provider needs 
JAVA_HOME; set it and re-run." >&2
+    exit 2
+  fi
+fi
+
 usage() {
   cat >&2 <<'EOF'
 Usage: run-standalone-suite.sh <id> [extra mvn args]

Reply via email to