On 15/06/2023 19:23, Joel Griffith wrote:
It looks like the JDT you mention is the Ubuntu package
`libeclipse-jdt-core-java`.

When I installed Tomcat 9 (9.0.31) on the functioning Ubuntu 20.04 system,
version 3.18.0+eclipse4.12-1 of this JDT package was installed as a
dependency.  When I installed Tomcat 9 (9.0.58) on the Ubuntu 22.04 system,
version 3.27.0+eclipse4.21-1 was installed.  Assuming the "4.12" and "4.21"
numbers are the JDT versions you're referring to, it seems like you're
right about the cause.

According to this table (https://tomcat.apache.org/whichversion.html),
Tomcat 9 is supposed to be compatible with Java 8, yet in this case it
seems to have broken compatibility on a patch update between 9.0.31 and
9.0.58.  In order to regain compatibility, the dependency on JDT should be
adjusted to a lower version.  Is this something the Tomcat people have to
handle, or is it the package maintainers at Canonical who make that choice?

That would be Canonical.

If you get Tomcat 9 from the ASF it works out of the box on Java 8. (You actually get the reverse issue with really new JDKs and very old JDTs but that isn't what is happening here).

Mark



Thanks,
Joel

On Thu, Jun 15, 2023 at 11:26 AM Rémy Maucherat <r...@apache.org> wrote:

On Thu, Jun 15, 2023 at 5:17 PM Joel Griffith <jgrif...@nd.edu.invalid>
wrote:

I'm setting up a JSP webapp on an Ubuntu 22.04 system.  The webapp uses
Tomcat 9 proxied through Apache 2, just as described here
<https://tomcat.apache.org/tomcat-9.0-doc/proxy-howto.html> .  I'm
recreating a setup that works on an Ubuntu 20.04/Tomcat 9 system, and has
worked in the past for earlier versions of both Ubuntu and Tomcat.

When I access the page https://localhost/app/foo, I get a 500 Internal
Server Error.  The error message is

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

The exception is

javax.servlet.ServletException: 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
org.apache.jasper.servlet.JspServlet.service(JspServlet.java:332)
javax.servlet.http.HttpServlet.service(HttpServlet.java:764)
org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:53)

There is no file by any variation of the name `INameEnvironment` in my
webapp code, and that string does not appear in any file.  I recognize
Eclipse as a popular IDE, but I don't use it.  The full stack trace
(which
I can provide if anyone thinks it would be useful) doesn't refer to any
other file I recognize.

Searching through the Tomcat source code on GitHub, I found the file `
java/org/apache/jasper/compiler/JDTCompiler.java` that appears to be the
source of the error.  This link takes you to the code snippet in
question:


https://github.com/search?q=repo%3Aapache%2Ftomcat%20INameEnvironment&type=code

Is this a bug?  It seems strange that it affects only one system when
I've
set up Tomcat 9 on many systems.  Is there something on the Ubuntu 22.04
system that might cause the bug to be thrown that I can fix?

The Java version on the Ubuntu 22.04 system (localhost) is
```
$ java -version
openjdk version "1.8.0_362"
OpenJDK Runtime Environment (build 1.8.0_362-8u362-ga-0ubuntu1~22.04-b09)
OpenJDK 64-Bit Server VM (build 25.362-b09, mixed mode)
```

and the Tomcat version is
```
$ java -cp catalina.jar org.apache.catalina.util.ServerInfo
Server version: Apache Tomcat/9.0.58 (Ubuntu)
Server built:   Jan 6 1970 15:09:28 UTC
Server number:  9.0.58.0
OS Name:        Linux
OS Version:     5.19.0-38-generic
Architecture:   amd64
JVM Version:    1.8.0_362-8u362-ga-0ubuntu1~22.04-b09
JVM Vendor:     Private Build
```

The Java version on the Ubuntu 20.04 server for which the webapp works is
effectively identical:
```
$ java -version
openjdk version "1.8.0_362"
OpenJDK Runtime Environment (build
1.8.0_362-8u372-ga~us1-0ubuntu1~20.04-b09)
OpenJDK 64-Bit Server VM (build 25.362-b09, mixed mode)
```

and its Tomcat version is
```
$ java -cp catalina.jar org.apache.catalina.util.ServerInfo
Server version: Apache Tomcat/9.0.31 (Ubuntu)
Server built:   Nov 18 2022 19:07:15 UTC
Server number:  9.0.31.0
OS Name:        Linux
OS Version:     5.4.0-150-generic
Architecture:   amd64
JVM Version:    1.8.0_362-8u372-ga~us1-0ubuntu1~20.04-b09
JVM Vendor:     Private Build
```

Thanks for any help you can give me.

JDT 4.20 (used for compiling generated code from your JSP) would be
the last version which supports Java 8. You seem to be using a newer
version through your distribution, which now requires Java 11.

Rémy


Joel

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org
For additional commands, e-mail: users-h...@tomcat.apache.org




---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org
For additional commands, e-mail: users-h...@tomcat.apache.org

Reply via email to