您可能会觉得这是一个重复的问题,但没有一个具有相同标题的问题能解决我的问题.我正在使用 Jersey 3.0 在 Eclipse 中创建一个 RESTful Web 服务,我使用 Tomcat 9.0 作为我的服务器.
You may feel this is a duplicated question, but none of the questions with the same title solve my problems. I am using Jersey 3.0 creating a RESTful web service in Eclipse, I use Tomcat 9.0 as my server.
Jersey 3.x 使用 Servlet5.0,现在使用 Jakarta 命名.所有 javax.servlet
打包现在都更改为 jakarta.servlet
.泽西岛 ServletContainer
现在扩展了 jakarta.servlet.http.HttpServlet
;它不再是 javax
了.第一个使用 Jakarta 的 Tomcat 是 Tomcat 10.x;Tomcat 9.x 仍然使用 javax.servlet
包装.所以如果你想使用 Jersey 3.x,那么你应该将你的 Tomcat 升级到 10.x.
Jersey 3.x uses Servlet 5.0, which now uses the Jakarta naming. All the javax.servlet
packaging has now changed to jakarta.servlet
. The Jersey ServletContainer
now extends jakarta.servlet.http.HttpServlet
; it is not javax
anymore. The first Tomcat to use Jakarta is Tomcat 10.x; Tomcat 9.x still uses the javax.servlet
packaging. So if you want to use Jersey 3.x, then you should upgrade your Tomcat to 10.x.