Background : Create a new Dynamic Web Project in eclipse, configure the local tomcat and write the code and select Run on Server, but after running, it is found that the webapps in the tomcat installation directory does not have the project name created. So where did the deployment go? Isn't it said that the good webapps directory is the directory where the application is stored?
Impact : Apparently the project is not automatically deployed to Tomcat's webapps but is deployed in another container. Enter http://localhost:8080 /webDemo/login.jsp in the built-in browser to open normally. But when I open http://localhost:8080 on an external browser, the expected kitten screen does not appear.
Reason : The reason eclipse is not like MyEclipse, which deploys the project to the webapps in the tomcat installation directory by default, but the default deployment to .metadata/.plugins/org.eclipse.wst.server.core/tmp1/wtpwebapps in the working directory, tmp1 The folder contains information about the project.
Difference : The difference between the wtpwebapps folder and the webapps folder under tomcat is that
is to point to the root directory
path of your program and access it program name
solution:
Modify In order to deploy the project to the webapps in the tomcat installation directory by default, show view—>servers—> find the tomcat that needs to be modified—> right click
①Stop the Tomcat server in eclipse (stop)
②Delete the project deployed in the container (add and remove)
③Clear the relevant data of the container (clean)
④Open the modification interface of tomcat (open)
⑤Find the servers location and select the second one (User tomcat Installation)
⑥ Modify the deploy path to webapps
⑦ Save and close
①②③ must be operated, otherwise the following steps will be grayed out and cannot be operated.