Bug 2374859 - tomcat doesn't recognize if a java (not openjdk) is already installed
Summary: tomcat doesn't recognize if a java (not openjdk) is already installed
Keywords:
Status: MODIFIED
Alias: None
Product: Fedora
Classification: Fedora
Component: tomcat
Version: 42
Hardware: All
OS: Linux
unspecified
medium
Target Milestone: ---
Assignee: Coty Sutherland
QA Contact: Fedora Extras Quality Assurance
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2025-06-25 22:18 UTC by bitchecker
Modified: 2025-07-11 14:15 UTC (History)
7 users (show)

Fixed In Version:
Clone Of:
Environment:
Last Closed: 2025-07-08 13:06:21 UTC
Type: ---
Embargoed:


Attachments (Terms of Use)

Description bitchecker 2025-06-25 22:18:51 UTC
If you try to install tomcat package, a default OpenJDK JRE (starting from 1.8.0) is installed.

If you choose the OpenJDK version, using "java-XX-openjdk" package, all deps are satisfied.

If you use another java (corretto, temurin) you'll install java-1.8.0-openjdk package, so it seems that the tomcat packate doesn't recognize if a valid JAVA binary is available on the server or not.

Reproducible: Always

Steps to Reproduce:
1. install system
2. install corretto/temurin repo
3. install corretto/temurin java jdk/jre
4. install tomcat package
Actual Results:
java-1.8.0-openjdk package is installed

Expected Results:
a "pass" check that a JAVA binary is installed should be pass and no other packages should be installed on the system.

Comment 1 Coty Sutherland 2025-06-26 11:59:46 UTC
The issue most likely stems from the java-headless (or java) requires at https://src.fedoraproject.org/rpms/tomcat/blob/rawhide/f/tomcat.spec#_113 not being met by the JDK package you're using. Can you provide the output of `rpm -q --provides` for the corretto/temurin java package? We can also look into making the requires more flexible, but ran into some issues with that in the past. Thanks for the report!

Comment 2 bitchecker 2025-06-26 12:42:29 UTC
hello,
thank you for your reply and your willingness to think about possible improvement!

From a "temurin-machine" I get:

$ rpm -q --provides temurin-21-jre
jre
jre-21
jre-21-headless
jre-21-openjre
jre-21-openjre-headless
jre-headless
jre-openjre
jre-openjre-headless
temurin-21-jre = 21.0.7.0.0.6-0
temurin-21-jre(x86-64) = 21.0.7.0.0.6-0

Comment 3 Dimitris Soumis 2025-07-08 13:06:21 UTC
After thorough investigation, the root of this behavior appears to be the `ecj` package, which is a runtime dependency of Tomcat.

Although Tomcat itself is compatible with third-party Java runtimes like Eclipse Temurin (e.g., `temurin-21-jre`), the installation of `ecj` triggers the installation of Fedora’s `java-21-openjdk-headless`. This is because `ecj` is a hybrid package that acts both as a Java library and as a command-line tool, and its current packaging imposes a hard requirement on Fedora’s OpenJDK. (More details here: https://bugzilla.redhat.com/show_bug.cgi?id=2376795)

As a result, users trying to run Tomcat with a different JRE will see OpenJDK pulled in even when a valid runtime is already installed.Since there is no strong demand for this change, we therefore do not plan to modify the package at this time.

We recommend third-party JRE users apply a manual workaround, such as:
dnf install tomcat --exclude='java*-openjdk*'

This limitation may be revisited in the future if broader demand emerges or if higher-level compatibility requirements arise.

Comment 4 bitchecker 2025-07-08 16:41:11 UTC
OK, so it will install java-*-openjdk package...but the real question, at this point is: which java runtime will use to run the tomcat package?

Comment 5 Dimitris Soumis 2025-07-10 14:53:26 UTC
By default tomcat uses whatever JRE is set as the system default. So even though java-*-openjdk-headless may be installed as a side-effect, tomcat will not necessarily use it at runtime.

Comment 6 bitchecker 2025-07-10 16:34:09 UTC
MMH,
this is not good because "not necessarily use it at runtime" means also "can be used"...so maybe you're installing a temurin21, but openjdk8 is installed as side-effect, and tomcat can run with openjdk8 instead of temurin21.

Comment 7 Dimitris Soumis 2025-07-11 14:15:14 UTC
Fedora’s current default OpenJDK is version 21, not 8. Fedora 41 & 42, currently ship Tomcat 9 which supports Java >= 8. The upcoming Tomcat 10 in Fedora 43, requires Java >= 11. 
That said, which Java runtime Tomcat actually uses at runtime depends entirely on what the user has configured as the system default JRE. Additionally, starting with the release of Tomcat 10, a startup script will run before Tomcat launches to automatically locate a suitable JRE if none has been explicitly configured.


Note You need to log in before you can comment on or make changes to this bug.