Tomcat 7.0.41启动正常但访问localhost:8080报HTTP Error 404求助
Hey Eric, let's dig into why you're hitting that HTTP Error 404 when accessing http://localhost:8080/ even though Tomcat started up with the confirmation:
INFO: Server startup in 9393 ms
Here are practical, step-by-step checks to resolve the issue:
Verify the default ROOT application exists
Tomcat serves its default landing page from thewebapps/ROOTdirectory. If this folder was deleted, renamed, or its core files are corrupted, you'll get a 404. Double-check that your Tomcat installation'swebappsfolder contains aROOTdirectory with at least a default index file (likeindex.htmlorindex.jsp).Check the Host configuration in
conf/server.xml
Sometimes the<Host>node'sappBaseproperty gets modified, preventing Tomcat from loading apps in the standardwebappsfolder. Locate the<Host>tag in yourserver.xmland ensure it matches the default setup:<Host name="localhost" appBase="webapps" unpackWARs="true" autoDeploy="true">If
appBasepoints to a different path, Tomcat won't look for the ROOT app where you expect it.Review startup logs for ROOT app deployment status
Beyond the startup time message, scan earlier console output for a line like:INFO: Deploying web application directory ROOT
If this line is missing, the ROOT app wasn't deployed at all. Common causes include file permission issues (Tomcat lacks read access towebapps/ROOT) or corrupted files within the ROOT directory.Confirm port 8080 is actually used by Tomcat
Even though yourConnectoris configured for port 8080, another process might be occupying that port—forcing Tomcat to fall back to a different port. Use these commands to verify:- Windows:
netstat -ano | findstr :8080 - Linux/macOS:
lsof -i :8080
Make sure the process ID linked to port 8080 matches Tomcat's running process.
- Windows:
Clear Tomcat's cache directories
Stale cached deployment data can cause unexpected glitches. Stop Tomcat, delete all contents in theworkandtempfolders under your Tomcat installation, then restart the server. This forces Tomcat to re-deploy all applications from scratch.
内容的提问来源于stack exchange,提问作者Eric Guzman

