Resolving 404 Error When Unable to Connect to localhost After Starting Tomcat in Eclipse

Dec 04, 2025 · Programming · 6 views · 7.8

Keywords: Eclipse | Tomcat | HTTP 404 | server configuration

Abstract: This article addresses the issue where Tomcat starts successfully in Eclipse but fails to connect to http://localhost:8085/, resulting in an HTTP 404 error. The cause is Eclipse's control over deployment preventing the default homepage from being deployed. The solution involves configuring Eclipse to use the Tomcat installation by selecting 'Use Tomcat installation' in server settings, removing modules, and publishing. This restores access to the default resources.

Introduction

When configuring and starting a Tomcat server in Eclipse, it may start successfully but fail to connect to http://localhost:8085/, returning an HTTP 404 error. This article analyzes the cause and provides a solution.

Problem Analysis

In Eclipse, when Tomcat is started, Eclipse might take control over deployment, causing the default Tomcat homepage not to be deployed correctly. The logs show successful startup on port 8085, but accessing the URL results in a 404 error, indicating the requested resource is unavailable. This differs from starting Tomcat outside Eclipse, where the default homepage is accessible.

Solution

To resolve this, configure Eclipse to use the Tomcat installation directory instead of letting Eclipse control deployment. Follow these steps:

  1. In the Servers tab in Eclipse, double-click the Tomcat server entry to open server configuration.
  2. On the configuration page, find the Server Locations section on the left.
  3. Select the Use Tomcat installation option. This allows Eclipse to use the actual Tomcat installation, ensuring proper deployment of the default homepage.
  4. If the option is grayed out, first remove all deployed modules. Right-click the server, select Add and remove..., remove all modules, then right-click and choose Publish.
  5. Restart the Tomcat server. Now, you should be able to access http://localhost:8085/ and see the default Tomcat homepage in your browser.

Notes

Port configuration is not the issue. If there were port problems, Tomcat would throw exceptions during startup, and the browser would show a connection timeout error instead of a Tomcat-specific 404 page. Ensure to publish the server after making changes.

Conclusion

By correctly configuring Eclipse to use the Tomcat installation directory, the 404 error when unable to connect to localhost after starting Tomcat can be resolved. This ensures the availability of default resources like the homepage and Tomcat Manager for development and testing.

Copyright Notice: All rights in this article are reserved by the operators of DevGex. Reasonable sharing and citation are welcome; any reproduction, excerpting, or re-publication without prior permission is prohibited.