I'm going to make a POC, get an old project, use the war exploded to deploy to the native Tomcat (version 8.5)
When you start Tomcat by IntelliJ idea, you find that the login page of the system is http-status-404 error, and when you open http://localhost:8080 directly in the browser, you can open the Tomcat welcome page, It means Tomcat is up, but it doesn't load the WebApps directory properly.
Even more strangely, the startup script under Tomcat's Bin directory can start normally, either by double-clicking Startup.bat or by using Catalina.bat run under the directory's CMD to start the project normally.
If you have a similar situation of friends, you can pay attention to the two startup mode at the start of the log environment variables, especially catalina_home.
Because the value of this variable is different on my machine when it is started in two ways, Catalina_home is the Tomcat directory where the bin is located when it is started by the bat script in the bin directory;
But when you start with IntelliJ idea, the value of the variable changes to: C:\Users\Cratical\. Intellijidea2017.1\system\tomcat\unnamed_test-project_3_0_4
Two directories under the Conf folder, the folder inside the name and number of configuration files are the same, through the comparison, found in the Conf directory, Server.xml content There are some differences, note this line
autodeploy= "true" deployonstartup= " False "deployignore=" ^ (?! (manager) | (Tomee) $). * ">
Because in IntelliJ idea, a war format artifact can modify the location of the output directory, the default is the target folder under the current project root directory, if you use IntelliJ directly When idea started Tomcat, the WebApps directory under the Tomcat directory was unable to find the associated deployment folder.
IntelliJ idea is to achieve this goal by generating one of its own catalina_home, modifying the appbase in Server.xml.
Go back to that line of configuration, note that the deployignore property, my web directory name is exactly matched by the above regular expression, so Tomcat is directly ignored when loading, resulting in the 404 error.
The meanings of the various configurations in Tomcat Server.xml, see: http://www.importnew.com/17124.html
Intellij idea + Tomcat resolution for HTTP status 404 error