我试图在Application上部署Hibernate测试项目(试用了Glassfish 5.0.1 & Tomcat 9.0.64),但我得到了以下错误:
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])我必须指出,我使用IntelliJ IDEA创建了这个项目,因为昨天我正在处理另一个项目,我使用泽西文档中描述的命令创建了这个项目,
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它在两台服务器上都有效。我的JRE和JDK版本相同(Java 8),我希望避免更改它。

昨天,当我试图使用IntelliJ IDEA创建一个项目时,我也遇到了同样的问题。知道是什么导致的吗?
发布于 2022-07-22 15:31:44
问题是依赖项的一个版本与我的JRE版本不兼容。
我将jersey-container-servlet-core在pom.xml文件中的版本属性指定为2.36,与JRE1.8兼容,然后再次构建该项目。
<dependency>
<groupId>org.glassfish.jersey.containers</groupId>
<artifactId>jersey-container-servlet-core</artifactId>
<version>2.36</version>
</dependency>因此,如果您收到此错误,您可能必须检查您的依赖项与当前JRE版本的兼容性。
https://stackoverflow.com/questions/73081838
复制相似问题