-
Bug
-
Resolution: Unresolved
-
Undefined
-
rhel-9.4
-
None
-
No
-
Important
-
rhel-sst-middleware
-
None
-
False
-
-
None
-
None
-
None
-
None
-
None
/etc/tomcat/tomcat.conf unconditionally sets the environment variable JAVA_HOME. This variable is generally set conditionally and in this case it should not be set at all and the decision should be left to /usr/share/java-utils/java-functions from the package javapackages-tools.
This issue was encountered when testing https://issues.redhat.com/browse/RHEL-62177. There is a short transition period when the default OpenJDK change is not implemented on OpenJDK side (/usr/lib/jvm/jre points to Java 11 but javapackages-tools Requires Java 17). This could also cause problems with future changes.
This package is also the only one out of the roughly 15 packages in RHEL 9 which require javapackages-tools at runtime which sets JAVA_HOME.
See /etc/tomcat/tomcat.conf in the similar package pki-servlet-engine-9.0.50-1.el9 which does not set JAVA_HOME.
Steps to reproduce:
- In RHEL 9.4 or 9.5 install the updated javapackages-tools and normal tomcat:
dnf -y install tomcat https://centos.softwarefactory-project.io/logs/19/19/65adb72a9d2257690285e960fef020f1605f5812/check/mock-build/e30631f/repo/javapackages-tools-6.0.0-4.el9/javapackages-tools-6.0.0-4.el9.noarch.rpm - remove the content of rm -rf /usr/lib/jvm/java-11-openjdk/*.
- run tomcat-digest or tomcat-tool-wrapper:
$ tomcat-digest /usr/bin/tomcat-digest: Failed to set JAVACMD /usr/bin/build-classpath: Failed to set JAVACMD /usr/bin/tomcat-digest: Failed to set JAVACMD /usr/share/java-utils/java-functions: line 267: exec: : not found
- run:
$ JAVA_HOME=/usr/lib/jvm/jre-17/ tomcat-digest (same output)
The output should have been:
$ tomcat-digest /usr/bin/build-classpath: Could not find commons-daemon Java extension for this JVM /usr/bin/build-classpath: error: Some specified jars were not found Usage: RealmBase [-a <algorithm>] [-e <encoding>] [-i <iterations>] [-s <salt-length>] [-k <key-length>] [-h <handler-class-name>] <credentials>
Proposed solution: follow what pki-servlet-engine-9.0.50-1.el9 does and do not set JAVA_HOME at all.