After the IntelliJ IDEA project runs successfully, you cannot access the Tomcat homepage or intellijtomcat
Problem
IntelliJ IDEA was used for the first time. However, after running the project to start Tomcat today, the Tomcat Homepage cannot be accessed. The Error 404 is displayed: Enter http: // localhost: 8080 and the Tomcat Homepage cannot be accessed, however, you can access other pages of the Project correctly.
Cause
This problem occurs because the output directory of the artifacts of our project is under the directory we specified, rather than under the webapps directory of Apache-tomcat installed in tomcat.
IDEA virtualizes a Tomcat under "project directory \ out \ artifacts", but there is no Tomcat home page project under this directory. At this time, the Tomcat home page project is not deployed on the server, so the Tomcat home page cannot be accessed, and other page information in our project is accessed.
Solution
The solution is to deploy the project of the Tomcat homepage to the Tomcat server. The deployment steps are as follows:
Select "Run --> Edit Configuration..." in the menu bar... --> Deployment, select "+" in the upper right corner, and select "External Source... ", select the ROOT folder under the Apache-tomcat webapps directory, click OK, and deploy the Tomcat homepage project. Select the ROOT file and choose not to fill in the Application Context on the right. The default value is enough.
Select "Run --> Edit Configuration... --> Deployment" in the menu bar, select "+" in the upper right corner, select "Artifact...", select the exploded item, and click "OK.
Enter the access URL name in Application Context on the right.
Run the project again and the project runs successfully.
Visit http: // localhost: 8080/again this time.