Tomcat is successfully started in Eclipse, but the home page cannot be opened
Symptoms:
Tomcat starts normally in Eclipse, but http://localhost:8080/ cannot be accessed in browser, and a 404 error is reported. Other project pages are also inaccessible.
Close Tomcat in Eclipse and double-click startup.bat in the tomcat installation directory to manually start the Tomcat server. Access HTT ://localhost:8080/ The Tomcat management page can be accessed.
Causes of symptoms:
Eclipse redirects tomcat's project release directory (WebApp in tomcat), so you won't find your project files in the Tomcat installation directory's WebApp directory.Copy the code
Solutions:
Reconfigure the Tomcat server:
On the Server page in Eclipse, double-click the Tomcat service and you will see the configuration page as shown:
Use workspace metadata(does not modify Tomcat installion)
If a project is deployed in Tomcat, the options in the red circle will be grayed out and cannot be changed until all deployed services are removed from Tomcat.
As shown in figure:
Right-click the Tomcat server and choose Add and Remove to Remove the deployed project in the dialog box that is displayed. After you remove the ok, you will see that the options panel section above is editable.
Select Use Tomcat Installation (Task Control of Tomcat Installation) to select the Tomcat installation directory as the project release directory.
And then, four lines down, you see “Deploy Path”? The default value after it is “wTPwebapps”, change it to “webapps”, which is tomcat
The name of the folder in which the project is published. Close the page and save the configuration. After deploying the project to webApp in the Tomcat installation directory, restart the Tomcat server and access http://localhost:8080, the project deployed by yourself can be accessed normally.
If it doesn’t work so far, as I did, then I recreate a Web project and test that Tomcat works
Test the JSP
Create a new JSP file in the WebConttent folder: new-other-web-jsp file. Modify file contents:
<%@ page language="java" contentType="text/html; charset=ISO-8859-1" import="java.util.Date" pageEncoding="ISO-8859-1"%> <! PUBLIC DOCTYPE HTML "- / / / / W3C DTD HTML 4.01 Transitional / / EN" "http://www.w3.org/TR/html4/loose.dtd" > < HTML > < head > <title>JSP--HelloWorld</title> </head> <body><center> <%=new Date() %> </center> </body> </html>Copy the code
To run and debug your application, click Start the Server or Start the Server in Debug mode on the Servers panel:
If the following figure appears, the Tomcat configuration is correct
So let’s type it in againhttp://localhost:8080You will find the welcome page appears, this is really magic, after following the above modification, I tried to restart Tomcat for many times, and after restarting Eclipse, there is no welcome page, after testing with a new Web project, I am also speechless…