Java version to work with TiNG

Hello!

I am trying to build my first TiNG solution in production but when uploading the war file on the Tomcat Server under Centos Linux, I allways receive an error related to the java version:
Caused by: java.lang.UnsupportedClassVersionError: com/servoy/j2db/log4j/LoggingServletContainerInitializer 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 (unable to load class com.servoy.j2db.log4j.LoggingServletContainerInitializer)

I have updated the java runtime to the last version I find in Centos (v11) and the same happens.

Regards

This has nothing todo with TiNG but the servoy version you use
Servoy 2022.12 and on needs Java17 for developer and deployment.
So you need to have a java17

not sure what CentOS 11 is because i can only find that they released 8.5 or someting like that (they don’t really show the versions like that anymore)

If your Java version is ok, it might be the wrong Tomcat version.
I was just trying to set up a new Ubuntu server and installed Tomcat 10 and had repeated errors, then saw a forum post saying to stick with Tomcat 9, so I downgraded to 9 and all ok now.

Hi, look at the bottom of your Tomcat manager console /manager/html. You will see the Java JVM Version.
In my case my Tomcat was running on Java 11, but I was trying to deploy a .war produced from Servoy 2022.12 which uses Java 17, so it failed.

Thank you jcompagner, rafig and swingman for your help!

That Centos has Apache Tomcat/7.0.76 and java 1.8.0_362-b08 as it shows under Tomcat Manager.

I tried to update java but nothing happened.

wars created with Servoy 2022.06 work fine but those created with 2022.12 fail.

Hi, I think you can have multiple Java versions installed. Tomcat will use the version it has been told to use, the setting will be in a configuration file.
So if you have Java 8 and 17 installed and Tomcat has been told to use 8, it will use 8.

My hoster sent me this message when they updated my server (Ubuntu 20.04):

I've installed OpenJDK 17.0.6 on <servername> and have configured Tomcat to use it. I've also increased the manager upload limit from 50MiB to 2GiB and have increased the Apache max request body size to match, which should prevent any issues with the proxy while uploading the .war.

I've upgraded the Tomcat version from 9.0.43 to 9.0.58, which is the latest available version currently packaged for Ubuntu 20.04 (Focal).

you really need to update stuff
And if centos doesn’t give that by there standard repo’s for the release you are using
you need to download them manually
because also the version of tomcat (7.x) is really old and should not be used anymore

you should be using one of the latest of Tomcat 9

jcompagner:
you really need to update stuff

Definitly, especially in production, where your customers data is your responsibility.

That said, you can check for automatically installed versions of java via:

sudo update-alternatives --config java

This gives you al list of JVMs on the machine, and you can then switch to your prefered one.

At least on ubuntu, If this doesn’t help for tomcat, you should check /etc/default/tomcat9 (or rather tomcat7 in your case) for this:

# The home directory of the Java development kit (JDK). You need at least
# JDK version 8. If JAVA_HOME is not set, some common directories for
# OpenJDK and the Oracle JDK are tried.
#JAVA_HOME=/usr/lib/jvm/java-8-openjdk
JAVA_HOME=/usr/lib/jvm/java-17-openjdk-amd64/

# You may pass JVM startup parameters to Java here. If you run Tomcat with
# Java 8 instead of 9 or newer, add "-XX:+UseG1GC" to select a suitable GC.
# If unset, the default options will be: -Djava.awt.headless=true
JAVA_OPTS="-Djava.awt.headless=true"

But please make sure your server is updated, perhaps you have to switch tomcat to a new version in your package manager.