Tomcat8 doesn't detect JRE > 8 when the default-jre package isn't installed

Bug #1780345 reported by Stefano Rivera
8
This bug affects 1 person
Affects Status Importance Assigned to Milestone
tomcat8 (Ubuntu)
Fix Released
Medium
Unassigned
Bionic
Fix Released
Medium
Unassigned

Bug Description

[Impact]
Tomcat won't start, unless default-jre-headless or openjdk-8-jre-headless is installed.

If openjdk-11-jre is installed, it won't be used, unless default-jre-headless is installed.

[Test Case]
In a minimal install:

# apt install tomcat8 openjdk-11-jre-headless
# service tomcat8 start

If you get this error, you have reproduced the bug:
 * no JDK or JRE found - please set JAVA_HOME

If it starts, all is good

[Regression Potential]
For some users, tomcat may now use Java 11 where it was previously using Java 8.

[Bug Description]
The tomcat8 init script contains:

find_jdks()
{
    for java_version in 9 8
    do
        for jvmdir in /usr/lib/jvm/java-${java_version}-openjdk-* \
                      /usr/lib/jvm/jdk-${java_version}-oracle-* \
                      /usr/lib/jvm/jre-${java_version}-oracle-* \
                      /usr/lib/jvm/java-${java_version}-oracle
        do
            if [ -d "${jvmdir}" ]
            then
                JDK_DIRS="${JDK_DIRS} ${jvmdir}"
            fi
        done
    done
}

# The first existing directory is used for JAVA_HOME (if JAVA_HOME is not
# defined in $DEFAULT)
JDK_DIRS="/usr/lib/jvm/default-java"
find_jdks

When the default-jre package is installed, this detects Java 11, but when it isn't, it doesn't.

# apt install tomcat8 openjdk-11-jre-headless
# /etc/init.d/tomcat8 start
 * no JDK or JRE found - please set JAVA_HOME

This was fixed in Debian in 8.5.31-1

Changed in tomcat8 (Ubuntu):
status: New → Fix Released
Changed in tomcat8 (Ubuntu Bionic):
importance: Undecided → Medium
Revision history for this message
Robie Basak (racb) wrote :

This looks reasonable but please could you fill in the SRU information as required by https://wiki.ubuntu.com/StableReleaseUpdates#Procedure?

Revision history for this message
Stefano Rivera (stefanor) wrote :

Yeah, just realised I forgot that, too.

description: updated
Revision history for this message
Steve Langasek (vorlon) wrote : Please test proposed package

Hello Stefano, or anyone else affected,

Accepted tomcat8 into bionic-proposed. The package will build now and be available at https://launchpad.net/ubuntu/+source/tomcat8/8.5.30-1ubuntu1.3 in a few hours, and then in the -proposed repository.

Please help us by testing this new package. See https://wiki.ubuntu.com/Testing/EnableProposed for documentation on how to enable and use -proposed.Your feedback will aid us getting this update out to other Ubuntu users.

If this package fixes the bug for you, please add a comment to this bug, mentioning the version of the package you tested and change the tag from verification-needed-bionic to verification-done-bionic. If it does not fix the bug for you, please add a comment stating that, and change the tag to verification-failed-bionic. In either case, without details of your testing we will not be able to proceed.

Further information regarding the verification process can be found at https://wiki.ubuntu.com/QATeam/PerformingSRUVerification . Thank you in advance!

Changed in tomcat8 (Ubuntu Bionic):
status: New → Fix Committed
tags: added: verification-needed verification-needed-bionic
Revision history for this message
Stefano Rivera (stefanor) wrote :

Works for me.

tags: added: verification-done verification-done-bionic
removed: verification-needed verification-needed-bionic
Revision history for this message
Łukasz Zemczak (sil2100) wrote :

Could you report which package version has been used for testing?

Revision history for this message
Brian Murray (brian-murray) wrote :

The version in -proposed works for me.

(bionic-amd64)root@impulse:/home/bdmurray# service tomcat8 start
 * Starting Tomcat servlet engine tomcat8 [ OK ]
(bionic-amd64)root@impulse:/home/bdmurray# apt-cache policy tomcat8
tomcat8:
  Installed: 8.5.30-1ubuntu1.3
  Candidate: 8.5.30-1ubuntu1.3
  Version table:
 *** 8.5.30-1ubuntu1.3 500
        500 http://192.168.10.7/ubuntu bionic-proposed/universe amd64 Packages
        100 /var/lib/dpkg/status
     8.5.30-1ubuntu1.2 500
        500 http://192.168.10.7/ubuntu bionic-updates/universe amd64 Packages
        500 http://security.ubuntu.com/ubuntu bionic-security/universe amd64 Packages
     8.5.30-1ubuntu1 500
        500 http://192.168.10.7/ubuntu bionic/universe amd64 Packages

Revision history for this message
Launchpad Janitor (janitor) wrote :

This bug was fixed in the package tomcat8 - 8.5.30-1ubuntu1.3

---------------
tomcat8 (8.5.30-1ubuntu1.3) bionic; urgency=medium

  * Search for Java 10 and 11 runtimes (LP: #1780345)

 -- Stefano Rivera <email address hidden> Mon, 16 Jul 2018 20:41:29 -0700

Changed in tomcat8 (Ubuntu Bionic):
status: Fix Committed → Fix Released
Revision history for this message
Brian Murray (brian-murray) wrote : Update Released

The verification of the Stable Release Update for tomcat8 has completed successfully and the package has now been released to -updates. Subsequently, the Ubuntu Stable Release Updates Team is being unsubscribed and will not receive messages about this bug report. In the event that you encounter a regression using the package from -updates please report a new bug using ubuntu-bug and tag the bug report regression-update so we can easily find any regressions.

To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.