Tomcat 10 升级注意事项

时间:2024-03-12 11:59:14

升级到Tomcat 10 的同学请注意,如果原项目中有依赖javax.servlet,需要将该依赖同步更新为jakarta.servlet

以下是原文:

Users of Tomcat 10 onwards should be aware that, as a result of the move from Java EE to Jakarta EE as part of the transfer of Java EE to the Eclipse Foundation, the primary package for all implemented APIs has changed from javax.* to jakarta.*. This will almost certainly require code changes to enable applications to migrate from Tomcat 9 and earlier to Tomcat 10 and later. A migration tool is under development to aid this process.

jakarta.servlet POM:https://mvnrepository.com/artifact/jakarta.servlet

升级Tomcat 10 后的常见错误:

Error during artifact deployment.
一个或多个listeners启动失败

java.lang.NoClassDefFoundError: javax/servlet/ServletContext

如果是由于升级Tomcat出现以上错误提示,请检查servlet