部分轉自於: https://blog.csdn.net/m0_52765092/article/details/115307947
tomcat版本和jdk版本的對應, 或者可以自己直鏈去看: https://tomcat.apache.org/whichversion.html
tomcat的版本也不易太老,否則會導致理論和實際不相適應: (盡量使用tomcat 8.x、tomcat 8.5、tomcat 9)
Tomcat10巨坑
結 論 : t o m c a t 9 和 t o m c a t 10 的 依 賴 包 不 是 同 一 個 。 \color{#FF3030}{結論:tomcat9和tomcat10的依賴包不是同一個。}結論:tomcat9和tomcat10的依賴包不是同一個。
tomcat9的包名以javax開頭:javax.*
t o m c a t 10 的 包 名 更 改 為 : j a k a r t a . ∗ \color{#FF3030}{tomcat10的包名更改為:jakarta.*}tomcat10的包名更改為:jakarta.∗
官網說名:
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 j a v a x . ∗ \color{#FF3030}{javax.*}javax.∗toj a k a r t a . ∗ \color{#FF3030}{jakarta.*}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.
而且tomcat10在結合springMVC使用時,DispatcherServlet在配置時會報錯。
現在(2021年3月30日)DispatcherServlet導的包:
軟件不是越新越好。