Tomcat 9 shipped with 22.04 distro sees java 8 compiled webapps as java 11 compi

Started by mahesh, Aug 31, 2023, 08:11 AM

Previous topic - Next topic

mahesh

Hi everybody,

on a fresh Virtulbox install of 22.04 LTS server version I installed through apt:

java 8 jdk/jre
tomcat 9


After that I copied in the tomcat9 webapps folder one of the webapps working under Java 8 in my 20.04 Virtualbox install.

Problem is that the distro Tomcat9 gives me :

*******************

HTTP Status 500 – Internal Server Error

Type Exception ReportMessage 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

Description The server encountered an unexpected condition that prevented it from fulfilling the request.Exceptionjavax.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(JspSe rvlet.java:332)
javax.servlet.http.HttpServlet.service(HttpServlet .java:764)
org.apache.tomcat.websocket.server.WsFilter.doFilt er(WsFilter.java:53)


Root Causejava.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
java.lang.ClassLoader.defineClass1(Native Method)
java.lang.ClassLoader.defineClass(ClassLoader.java :756)
java.security.SecureClassLoader.defineClass(Secure ClassLoader.java:142)
java.net.URLClassLoader.defineClass(URLClassLoader .java:473)
java.net.URLClassLoader.access$100(URLClassLoader. java:74)
java.net.URLClassLoader$1.run(URLClassLoader.java: 369)
java.net.URLClassLoader$1.run(URLClassLoader.java: 363)
java.security.AccessController.doPrivileged(Native Method)
java.net.URLClassLoader.findClass(URLClassLoader.j ava:362)
java.lang.ClassLoader.loadClass(ClassLoader.java:4 18)
java.lang.ClassLoader.loadClass(ClassLoader.java:3 51)
java.lang.Class.forName0(Native Method)
java.lang.Class.forName(Class.java:264)
org.apache.jasper.JspCompilationContext.createComp iler(JspCompilationContext.java:247)
org.apache.jasper.JspCompilationContext.createComp iler(JspCompilationContext.java:225)
org.apache.jasper.JspCompilationContext.compile(Js pCompilationContext.java:597)
org.apache.jasper.servlet.JspServletWrapper.servic e(JspServletWrapper.java:399)
org.apache.jasper.servlet.JspServlet.serviceJspFil e(JspServlet.java:379)
org.apache.jasper.servlet.JspServlet.service(JspSe rvlet.java:327)
javax.servlet.http.HttpServlet.service(HttpServlet .java:764)
org.apache.tomcat.websocket.server.WsFilter.doFilt er(WsFilter.java:53)
Note The full stack trace of the root cause is available in the server logs.


*******************

like the app was compiled with Java 11 (which isn't).

The important thing is that if I manually install Tomcat on the 22.04 VM the app works flawlessly.

Has somebody else incurred in this strange behaviour?

Is there a bug in the Apt Tomcat9 install, since the manual install from the .tar.gz file works well?

If more data is required please simply ask.

Thanks in advance

Best Wishes