升級到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
