Tomcat10升級介紹
Tomcat10 修補了之前版本的漏洞,主要是JAVAx的漏洞,導致使用javax jar包的項目不能直接部署,需要使用官方工具轉換。
Apache官網提供轉換程序
https://github.com/apache/tomcat-jakartaee-migration
Apache官方說明: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 has been developed to aid this process.
大意是:由于Java EE 改為 Jakarta EE,javax. 的包全都換成 jakarta.。Tomcat9以及之前的版本需要使用工具來轉換一下。
轉換步驟
- 使用上邊提供地址下載項目并導入,運行mvn compile package,生成jar包;
- 或者直接運行jar包:本人打包后的jar下載地址 :https://download.csdn.net/download/linzi19900517/34210765
java -jar jakartaee-migration-版本號-shaded.jar D:源路徑demo.war D:目標路徑newdemo.war
3.將新war包放入tomcat啟動即可。