Selection of external Tomcat version when Spring Boot 2.7.X makes war package

test environment

Tomcat 10.0.23
Tomcat 9.0.69

I recently worked on a Spring Boot project, and I chose the 2.7.X version. I wanted to make a war package for external Tomcat testing, so I went to Tomcat’s official website and downloaded a Tomcat 10 version, but after a long time, I didn’t run it. After a while, I didn’t know whether it was a Tomcat problem or a war package problem, so I went to IDEA to check the built-in Tomcat version. It was Tomcat 9. Could it be a version problem, so I went to Tomcat’s official website to download the Tomcat 9 version. This time I started running. Although I know it should be a version problem, the higher version of Tomcat 10 should be compatible with Tomcat 9. Why can't it be compatible? In fact, the answer has been told to us before downloading, but we may not pay attention to it when downloading. There is such a passage at the top of the download page:

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.

The commonly used main package javax has been changed to jakarta, so applications developed on Tomcat 9 cannot be directly migrated to Tomcat 10.

More intuitively, you can directly decompress lib\servlet-api in the Tomcat directory, 9 is javax, and 10 is jakarta.

Guess you like

Origin blog.csdn.net/a7442358/article/details/129067099