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.

Joel

Reply via email to