gpt4 book ai didi

java - 我如何使用 JDK 1.7 运行 jersey 2.26?

转载 作者:搜寻专家 更新时间:2023-11-01 01:12:09 25 4
gpt4 key购买 nike

我的应用程序使用 JDK1.7。

我升级了 jersey 2.26,现在出现错误:

严重: Servlet [Jersey Web Application] in web application [/spcsis-1.0] threw load() exception
java.lang.UnsupportedClassVersionError: org/glassfish/jersey/servlet/ServletContainer : Unsupported major.minor version 52.0 (unable to load class org.glassfish.jersey.servlet.ServletContainer)
at org.apache.catalina.loader.WebappClassLoaderBase.findClassInternal(WebappClassLoaderBase.java:3129)
at org.apache.catalina.loader.WebappClassLoaderBase.findClass(WebappClassLoaderBase.java:1341)
at org.apache.catalina.loader.WebappClassLoaderBase.loadClass(WebappClassLoaderBase.java:1827)
at org.apache.catalina.loader.WebappClassLoaderBase.loadClass(WebappClassLoaderBase.java:1701)
at org.apache.catalina.core.DefaultInstanceManager.loadClass(DefaultInstanceManager.java:504)
at org.apache.catalina.core.DefaultInstanceManager.loadClassMaybePrivileged(DefaultInstanceManager.java:486)
at org.apache.catalina.core.DefaultInstanceManager.newInstance(DefaultInstanceManager.java:113)
at org.apache.catalina.core.StandardWrapper.loadServlet(StandardWrapper.java:1146)
at org.apache.catalina.core.StandardWrapper.load(StandardWrapper.java:1085)
at org.apache.catalina.core.StandardContext.loadOnStartup(StandardContext.java:5318)
at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5610)
at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:147)
at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1572)
at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1562)
at java.util.concurrent.FutureTask.run(FutureTask.java:262)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
at java.lang.Thread.run(Thread.java:724)

我已经将 jdk 更改为 1.8 然后它可以工作,但是我必须为我的项目使用 jdk1.7。

有人可以帮我做吗?

最佳答案

从 Jersey 2.26 开始,所有模块只支持 Java SE 8

参见 Jersey dependencies :

Until version 2.6, Jersey was compiled with Java SE 6. This has changed in Jersey 2.7.

Up to version 2.25.x almost all Jersey components are compiled with Java SE 7 target. It means, that you will need at least Java SE 7 to be able to compile and run your application that is using latest Jersey. Only core-common and core-client modules are still compiled with Java class version runnable with Java SE 6.

Since Jersey 2.26, all modules are build using Java SE 8 and there is no support for running it on older Java SE distributions.

关于java - 我如何使用 JDK 1.7 运行 jersey 2.26?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/45210746/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com