Score:0

Tomcat 11 error compiled by a more recent version of the Java Runtime (class file version 61.0)

ky flag
JBD

I have installed Tomcat 11.0.0-M6 and I get this error message every time I want to start it for the first time:

Error: LinkageError occurred while loading main class org.apache.catalina.startup.Bootstrap java.lang.UnsupportedClassVersionError: org/apache/catalina/startup/Bootstrap has been compiled by a more recent version of the Java Runtime (class file version 61.0), this version of the Java Runtime only recognizes class file versions up to 55.0

I have checked Java version by doing java -version and I get that is version 11 corresponding to the class file version 55 as requested by Tomcat: java version "11.0.12" 2021-07-20 LTS Java(TM) SE Runtime Environment 18.9 (build 11.0.12+8-LTS-237) Java HotSpot(TM) 64-Bit Server VM 18.9 (build 11.0.12+8-LTS-237, mixed mode)

Then I did update-alternatives --display java and I get:

java - manual mode
  link best version is /opt/jdk/jdk-11.0.12/bin/java
  link currently points to /opt/jdk/jdk-11.0.12/bin/java
  link java is /usr/bin/java
/opt/jdk/jdk-11.0.12/bin/java - priority 100
/opt/jdk/jdk-17.0.7/bin/java - priority 100
/opt/jdk/jdk1.8.0_301/bin/java - priority 100

And we can see that is Java 11 that is used and not Java 17

There is tomcat.service file:

[Unit]
Description="Tomcat Service"
After=network.target
[Service]
Type=forking
User=tomcat
Group=tomcat
RestartSec=10
Restart=always


Environment="JAVA_HOME=/opt/jdk/jdk-11.0.12"
Environment="JAVA_OPTS=-Djava.awt.headless=true -Djava.security.egd=file:/dev/./urandom"
Environment="CATALINA_BASE=/opt/tomcat"
Environment="CATALINA_HOME=/opt/tomcat"
Environment="CATALINA_PID=/opt/tomcat/temp/tomcat.pid"
Environment="CATALINA_OPTS=-Xms512M -Xmx1024M -server -XX:+UseParallelGC"
ExecStart=/opt/tomcat/bin/startup.sh
ExecStop=/opt/tomcat/bin/shutdown.sh

[Install]
WantedBy=multi-user.target
[Service]
Environment="CATALINA_OPTS=-Djava.library.path=/usr/java/packages/lib/amd64:/usr/lib/x86_64-linux-gnu:/usr/lib64:/lib64:/lib:/usr/lib"

Does anyone have any idea what caused the error?

Thanks for your help

Andrew Henle avatar
ph flag
*that is version 11 corresponding to the class file version 55 as requested by Tomcat* Huh?!?! How do you get the Tomcat install you're trying to run requires version 55 from `org/apache/catalina/startup/Bootstrap has been compiled by a more recent version of the Java Runtime (class file version 61.0)`
JBD avatar
ky flag
JBD
I've downloaded it from ``https://downloads.apache.org/tomcat/tomcat-11/v11.0.0-M6/bin/apache-tomcat-11.0.0-M6.tar.gz``. What should I do to resolve the problem? :)
mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.