Troubleshooting Guide for Tomcat 7 Running in Eclipse but Showing 'Requested Resource Not Available' in Browser

Dec 07, 2025 · Programming · 12 views · 7.8

Keywords: Tomcat Troubleshooting | Eclipse Configuration | HTTP Port Settings

Abstract: This article provides an in-depth analysis of the common causes and solutions for the error 'Requested resource not available' when accessing http://localhost:8080/ after starting Apache Tomcat 7 server in Eclipse. Based on the checklist from the best answer, it systematically explores key factors such as port configuration, default application deployment, and proxy settings, integrating supplementary information from other answers on Eclipse-specific configurations and project URL access. With detailed step-by-step instructions and code examples, it helps developers quickly diagnose and resolve this common development environment issue.

Problem Overview

When using the Eclipse integrated development environment, developers often encounter a scenario where the Apache Tomcat 7 server starts successfully in Eclipse, but accessing http://localhost:8080/ via a browser displays the error message "Requested resource not available." This issue can stem from multiple factors and requires systematic troubleshooting. This article provides a comprehensive guide based on best practices and common solutions from technical communities.

Core Cause Analysis

According to the checklist from the best answer, this problem primarily involves three key aspects:

  1. Port Configuration Issues: Tomcat defaults to running on port 8080, but it may be configured to use a different port. For example, if the port is modified in the server configuration file, accessing the default URL will fail. Check the <Connector port="8080"/> setting in the server.xml file to ensure consistency. In Eclipse, verify the port settings through the server configuration view.
  2. Default Application Deployment Issues: Tomcat's default page is located at TOMCAT_ROOT_DIRECTORY/webapps/ROOT/index.jsp. If this application is removed or not deployed correctly, the browser will fail to load the default resource. When starting Tomcat independently, this page is typically available automatically; but in Eclipse, ensure that the ROOT application is included in the deployment path. For instance, check if the "Publish modules to server" option is enabled in Eclipse's server configuration.
  3. Proxy Settings Interference: Browser or system proxy configurations may cause local requests to be misrouted. Ensure that the browser does not have a proxy enabled, or add local addresses to the proxy exception list. At the code level, Java applications might set proxies via system properties, such as System.setProperty("http.proxyHost", "proxy.example.com"), which should be inspected and adjusted.

Eclipse-Specific Configuration Supplements

Other answers provide supplementary solutions for the Eclipse environment:

Code Examples and In-Depth Analysis

To further illustrate the impact of port configuration, consider the following server.xml snippet:

<Connector port="8080" protocol="HTTP/1.1" connectionTimeout="20000" redirectPort="8443"/>

If the port is modified to 8081, you must access http://localhost:8081/. In Eclipse, you can programmatically check port settings:

import java.net.ServerSocket;
public class PortChecker {
    public static void main(String[] args) {
        try (ServerSocket serverSocket = new ServerSocket(8080)) {
            System.out.println("Port 8080 is available.");
        } catch (IOException e) {
            System.out.println("Port 8080 is in use. Check Tomcat configuration.");
        }
    }
}

This code attempts to bind to port 8080; if it fails, it indicates that the port is in use or misconfigured. For proxy issues, developers can disable proxies in the application:

System.clearProperty("http.proxyHost");
System.clearProperty("http.proxyPort");

This ensures that HTTP requests are sent directly to the local server, avoiding proxy interference.

Comprehensive Troubleshooting Steps

Based on the above analysis, it is recommended to troubleshoot in the following steps:

  1. Verify Tomcat Port: Check server.xml and Eclipse server configuration to ensure the port is 8080 or the corresponding value.
  2. Check Default Application: Confirm that the webapps/ROOT directory exists and contains the index.jsp file. In Eclipse, ensure the server configuration includes the ROOT module.
  3. Disable Proxies: Turn off proxy settings in the browser and Java system properties.
  4. Test Project URL: Access http://localhost:8080/YourProjectName; if successful, it indicates the server is running normally, but there is an issue with the default page configuration.
  5. Adjust Eclipse Settings: In Server Locations, select the "Use Tomcat installation" option, save, and restart the server.

By systematically applying these steps, most "Requested resource not available" errors can be effectively resolved. This process is applicable not only to Tomcat 7 but also to other versions and similar server environments.

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.