Skip to content

Eclipse & Tomcat Error: HTTP Status 404 – Not Found: [closed]

Description: The origin server did not find a current representation for the target resource or is not willing to disclose that one exists.

This is my HomeController Class:

package com.luv2code.springdemo.mvc;

import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;

public class HomeController {

    public String showPage() {
        return "main-menu";

This is my Web.xml File:

<?xml version="1.0" encoding="UTF-8"?>
<web-app xmlns:xsi=""
    id="WebApp_ID" version="3.1">


    <!-- Spring MVC Configs -->

    <!-- Step 1: Configure Spring MVC Dispatcher Servlet -->

    <!-- Step 2: Set up URL mapping for Spring MVC Dispatcher Servlet -->


This is spring-mvc-demo-servlet file

<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns=""

    <!-- Step 3: Add support for component scanning -->
    <context:component-scan base-package="com.luv2code.springdemo" />

    <!-- Step 4: Add support for conversion, formatting and validation support -->

    <!-- Step 5: Define Spring MVC view resolver -->
        <property name="prefix" value="/WEB-INF/view/" />
        <property name="suffix" value=".jsp" />


This is main-menu.jsp file



<h2>Spring MVC Demo - Home Page</h2>


<a href="showForm">Hello World form</a>


Here is the Image of Directory

Directory Image in Eclipse

PS: I have tried all other option including switching the location, cleaning the directory and reinstalling tomcat and eclipse but all these are not working for me.Even, I changed the IDE from Eclipse to IntelliJ Idea but problem persists.



Since your servlet name is ‘dispatcher’ Spring looks for the file dispatcher-servlet.xml in the default location of your WEB-INF folder. Try renaming spring-mvc-demo-servlet.xml to dispatcher-servlet.xml and it will work.Hope it helps, Thanks