smolnar82 opened a new pull request, #1141: URL: https://github.com/apache/knox/pull/1141
[KNOX-3246](https://issues.apache.org/jira/browse/KNOX-3246) - Make Java discovery deterministic on hosts with multiple JDKs ## What changes were proposed in this pull request? Extend JAVA_VERSION_PATTERNS to include modern JDK layouts and /usr/java/default. Follow symlinks during discovery and sort candidates to ensure deterministic Java selection on hosts with multiple JDKs installed. ## How was this patch tested? Tested on my cluster with mixed JDK versions. ``` $ cat smolnar_test.sh #!/usr/bin/env bash . /$KNOX_HOME/bin/knox-functions.sh setVerbose "$@" checkJava ``` Prior to my changes: ``` $ ./smolnar_test.sh --verbose Found Java at /usr/java/jdk1.11.70.15-z.0_lu/bin/java ``` My changes included: ``` $ ./smolnar_test.sh --verbose Found Java at /usr/java/default/bin/java $ /usr/java/default/bin/java -version openjdk version "17.0.11" 2024-04-16 OpenJDK Runtime Environment OpenLogic-OpenJDK (build 17.0.11+9-adhoc.root.jdk17u) OpenJDK 64-Bit Server VM OpenLogic-OpenJDK (build 17.0.11+9-adhoc.root.jdk17u, mixed mode, sharing) ``` ## Integration Tests This issue is hard to reproduce in the existing docker-based framework. It requires a multi JDK setup which usually happens at cluster upgrade time. ## UI changes None -- 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]
