I am trying to deploy a Hibernate test project on an Application Server (tried Glassfish 5.0.1 & Tomcat 9.0.64) but I get the following error:
java.lang.RuntimeException: java.util.concurrent.ExecutionException: java.lang.UnsupportedClassVersionError: jakarta/ws/rs/core/FeatureContext 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 (unable to load class [jakarta.ws.rs.core.FeatureContext])
I have to mention that I created this project using IntelliJ IDEA, because yesterday I was working on another project, which I created using the command described in Jersey Documentation,
mvn archetype:generate -DarchetypeArtifactId=jersey-quickstart-webapp -DarchetypeGroupId=org.glassfish.jersey.archetypes -DinteractiveMode=false -DgroupId=com.example -DartifactId=simple-service-webapp -Dpackage=com.example -DarchetypeVersion=2.36
and it worked on both servers. My JRE and JDK are on same version (Java 8) and I would like to avoid changing it.
I had the same problem yesterday, when I tried to create a Project using IntelliJ IDEA. Any IDEA what could have caused this?

The problem was that one of the dependencies' version was not compatible with my JRE version.
I specified the version attribute for
jersey-container-servlet-coreinpom.xmlfile to be 2.36 which is compatible with JRE 1.8, and then built the project again.So if you get this error, you probably have to check your dependencies compatibility with your current JRE version.