22.04 tomcat9 with openjdk8 JSP compilation error

Bug #1972829 reported by Nyari Zoltan
10
This bug affects 2 people
Affects Status Importance Assigned to Milestone
tomcat9 (Ubuntu)
Confirmed
Undecided
Unassigned

Bug Description

Hi,

After a new Ubuntu 22.04 install, we have installed the openjdk8 and tomcat9 packages:
sudo apt install openjdk-8-jdk
sudo apt install tomcat9

After the install we have tested it by deploying the sample application, from https://tomcat.apache.org/tomcat-9.0-doc/appdev/sample/

The Sample contains a simple JSP page, which throws an error:
Message java.lang.UnsupportedClassVersionError: org/eclipse/jdt/internal/compiler/env/INameEnvironment has been compiled by a more recent version of the Java Runtime (class file version 55.0), this version of the Java Runtime only recognizes class file versions up to 52.0

This class is in the libeclipse-jdt-core-java package, which seems to be compiled using Java 11 target settings.

Tomcat 9 is officially supported on JDK 8, so I think the libeclipse-jdt-core-java package should also support Java 8.

Also we could find a workaround: installing the libecj-java package (which supports Java 8) and creating a symlink in the tomcat9 lib directory.

Thanks,
Zoltan

System Info:

Description: Ubuntu 22.04 LTS
Release: 22.04

tomcat9:
  Installed: 9.0.58-1
  Candidate: 9.0.58-1
  Version table:
 *** 9.0.58-1 500
        500 http://hu.archive.ubuntu.com/ubuntu jammy/universe amd64 Packages
        100 /var/lib/dpkg/status

openjdk-8-jdk:
  Installed: 8u312-b07-0ubuntu1
  Candidate: 8u312-b07-0ubuntu1
  Version table:
 *** 8u312-b07-0ubuntu1 500
        500 http://hu.archive.ubuntu.com/ubuntu jammy/universe amd64 Packages
        100 /var/lib/dpkg/status

libeclipse-jdt-core-java:
  Installed: 3.27.0+eclipse4.21-1
  Candidate: 3.27.0+eclipse4.21-1
  Version table:
 *** 3.27.0+eclipse4.21-1 500
        500 http://hu.archive.ubuntu.com/ubuntu jammy/universe amd64 Packages
        100 /var/lib/dpkg/status

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

Status changed to 'Confirmed' because the bug affects multiple users.

Changed in tomcat9 (Ubuntu):
status: New → Confirmed
Revision history for this message
jmz (jmzb) wrote :

For references here is this same issue reported on the Debian bug tracker: https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=1006647

They seem to have decided to drop support for jre8 going forward, and thus have changed the tomcat9 package to depend on java11-runtime-headless rather than default-jre-headless (see this commit: https://salsa.debian.org/java-team/tomcat9/-/commit/f866eaf2e3db98fb785f012ceeb97ec04b141aa8)

@Nyari Zoltan, it would be a great help to me if you could be more specific about your workaround. What are the exact paths of the target and link in the symbolic link you created?

Thanks in advance,
James

Revision history for this message
Nyari Zoltan (nyariz) wrote :

Hi,

Thanks, the workaround was (I hope I remember correctly):
sudo apt install libecj-java
sudo ln -s /usr/share/java/ecj.jar /var/lib/tomcat9/lib
sudo systemctl restart tomcat9

If I may suggest, I think Ubuntu (and also Debian) should support Tomcat9 running on OpenJDK 8, because it is still supported (as far as I know, the end-of-life dates have not been announced yet). There are a large number of internal/enterprise software which has not been ported to Java 11.

Best regards,
Zoltan

Revision history for this message
jmz (jmzb) wrote :

Hey Zoltan thank you very much for the instructions.

I also agree that Ubuntu should continue to support Tomcat9 on JDK8 for the same reason. With Debain it is less clear as they do not provided a JDK8 package in the official repositories any more, so I understand their reasoning.

As a side note, I would like to say that Debain Bullseye (stable) currently ships with libeclipse-jdt-core-java 4.18 (https://packages.debian.org/bullseye/libeclipse-jdt-core-java), which appears to be compiled for Java 8.

I have just successfully installed a Java 8 only tomcat9 web application on Debian Bullseye by installing JRE8 using the third party Adoptium repository to install temurin-8-jdk (see https://adoptium.net/installation/linux)

Obviously this does not solve the issue in regards to Ubuntu but I thought the information may be useful to some. It is unfortunate that this workaround will no longer be possible for the next major Debian release.

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.