Bug #34130
openPuppetserver runs under Java 8 instead of Java 11 in Katello scenario
Description
The puppet-candlepin configuration we have is designed to install and ensure Java 11 is present and Tomcat runs under this version. Which it does:
● tomcat.service - Apache Tomcat Web Application Container Loaded: loaded (/usr/lib/systemd/system/tomcat.service; enabled; vendor preset: disabled) Active: active (running) since Fri 2021-12-10 16:11:33 UTC; 43min ago Main PID: 2405 (java) Tasks: 77 (limit: 50720) Memory: 1004.8M CGroup: /system.slice/tomcat.service └─2405 /usr/lib/jvm/jre-11/bin/java
However, one of the dependencies of Tomcat is tomcatjss which has a requires on openjdk-1.8.0:
[root@pipe-katello-server-nightly-centos8 vagrant]# rpm -q tomcatjss --requires apache-commons-lang3 java-1.8.0-openjdk-headless jpackage-utils >= 0:1.7.5-15 jss >= 4.9.0 jss < 5.0.0 pki-servlet-engine >= 1:9.0.7 rpmlib(CompressedFileNames) <= 3.0.4-1 rpmlib(FileDigests) <= 4.6.0-1 rpmlib(PayloadFilesHavePrefix) <= 4.0-1 rpmlib(PayloadIsXz) <= 5.2-1 slf4j slf4j-jdk14
This leads to the default java version being 8 and not 11:
[root@pipe-katello-server-nightly-centos8 vagrant]# update-alternatives --config java There are 2 programs which provide 'java'. Selection Command ----------------------------------------------- *+ 1 java-1.8.0-openjdk.x86_64 (/usr/lib/jvm/java-1.8.0-openjdk-1.8.0.312.b07-2.el8_5.x86_64/jre/bin/java) 2 java-11-openjdk.x86_64 (/usr/lib/jvm/java-11-openjdk-11.0.13.0.8-3.el8_5.x86_64/bin/java)
Puppetserver's start up command relies on calling /usr/bin/java which is always set to whatever the current alternative is set to. This means that Puppetserver ends up running under Java 8 instead of the newer Java 11:
● puppetserver.service - puppetserver Service Loaded: loaded (/usr/lib/systemd/system/puppetserver.service; enabled; vendor preset: disabled) Active: activating (start) since Fri 2021-12-10 16:52:58 UTC; 8s ago Cntrl PID: 20787 (bash) Tasks: 37 (limit: 4915) Memory: 503.2M CGroup: /system.slice/puppetserver.service ├─20787 bash /opt/puppetlabs/server/apps/puppetserver/cli/apps/start ├─20816 /usr/bin/java
We either need to solve this packaging problem (we get tomcatjss from pki-core) or find a way to adjust the alternatives to ensure Java 11 is the default enabled.
Updated by Ewoud Kohl van Wijngaarden almost 3 years ago
You should be able to run --puppet-server-jvm-java-bin /usr/lib/jvm/jre-11/bin/java to get it to use Java 11. This is not pretty and there should be a better way. However, it should provide a way to verify it works.
Updated by Evgeni Golov almost 3 years ago
This makes me ask more questions than you originally signed up for, and I am already sorry.
- For Puppet, I think puppet-puppet should just configure the right Java we want it to use, instead of using /usr/bin/java?
- Why does tomcatjss depend on a specific JDK? To the best of my knowledge, compiling Java code with JDK N guarantees that the binary is (technically) compatible with EVERY N+x JDK
Updated by Rune Philosof 8 months ago
It is no longer tomcatjss
, but the result is still the same. pki-servlet-engine
requires java-1.8.0
.
dnf repoquery --whatdepends java-1.8.0-openjdk --installed
# java-1.8.0-openjdk-devel-1:1.8.0.402.b06-2.el8.x86_64
dnf repoquery --whatdepends java-1.8.0-openjdk-devel --installed
# ant-0:1.10.5-1.module+el8+2598+06babf2e.noarch
# pki-servlet-engine-1:9.0.50-1.module+el8.7.0+15761+f86c9a56.noarch
dnf repoquery --whatdepends pki-servlet-engine --installed
# candlepin-0:4.3.12-1.el8.noarch