title: Tomcat can't load my jsp file - server did not find a current representation
body: <p>I'm constantly getting this error: </p>
  
  <blockquote>
    <p>The origin server did not find a current representation for the target
    resource or is not willing to disclose that one exists.</p>
    
    <p>WARNING [http-nio-8080-exec-6] org.springframework.web.servlet.PageNotFound.noHandlerFound No mapping found for HTTP request with URI [/] in DispatcherServlet with name 'SpringMVC' </p>
  </blockquote>
  
  <p>I'm trying to use Java configuration on a very simple code. I have this config class:</p>
  
  <pre><code> package com.kemal.config;
  
      import org.springframework.context.annotation.ComponentScan;
      import org.springframework.context.annotation.Configuration;
  
      @Configuration
      @ComponentScan(basePackages = {"com.kemal", "com.kemal.controllers", "com.kemal.services"})
      public class JavaConfig {
  
      }
  </code></pre>
  
  <p>This is my controller class:</p>
  
  <pre><code>package com.kemal.controllers;
  
  import org.springframework.stereotype.Controller;
  import org.springframework.web.bind.annotation.RequestMapping;
  
  @Controller
  public class Controller1{
  
      @RequestMapping("/")
      public String home (){
          return "index";
      }
  
      @RequestMapping("/add")
      public String add(){
          return "display";
      }
  }
  </code></pre>
  
  <p>Tomcat is deploying Application context to this URL "/"</p>
  
  <p>web.xml:</p>
  
  <pre><code>&lt;!DOCTYPE web-app PUBLIC
   "-//Sun Microsystems, Inc.//DTD Web Application 2.3//EN"
   "http://java.sun.com/dtd/web-app_2_3.dtd" &gt;
  
  &lt;web-app&gt;
    &lt;servlet&gt;
      &lt;servlet-name&gt;SpringMVC&lt;/servlet-name&gt;
      &lt;servlet-class&gt;org.springframework.web.servlet.DispatcherServlet&lt;/servlet-class&gt;
      &lt;load-on-startup&gt;1&lt;/load-on-startup&gt;
    &lt;/servlet&gt;
  
    &lt;servlet-mapping&gt;
      &lt;servlet-name&gt;SpringMVC&lt;/servlet-name&gt;
      &lt;url-pattern&gt;/&lt;/url-pattern&gt;
    &lt;/servlet-mapping&gt;
  
  &lt;/web-app&gt;
  </code></pre>
  
  <p>SpringMVC-servlet.xml:</p>
  
  <pre><code>&lt;beans xmlns="http://www.springframework.org/schema/beans"
     xmlns:ctx="http://www.springframework.org/schema/context"
     xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
     xmlns:mvc="http://www.springframework.org/schema/mvc"
     xmlns:context="http://www.springframework.org/schema/c"
     xsi:schemaLocation="http://www.springframework.org/schema/beans
  http://www.springframework.org/schema/beans/spring-beans-2.5.xsd
  http://www.springframework.org/schema/mvc
  http://www.springframework.org/schema/mvc/spring-mvc-3.0.xsd
  http://www.springframework.org/schema/context
  http://www.springframework.org/schema/context/spring-context-2.5.xsd "&gt;
  
  &lt;ctx:annotation-config/&gt;
  &lt;!--&lt;context:component-scan base-package="com"/&gt;--&gt;
  
  &lt;bean class="org.springframework.web.servlet.view.InternalResourceViewResolver"&gt;
      &lt;property name="prefix" value="/WEB-INF/jsp/"/&gt;
      &lt;property name="suffix" value=".jsp"/&gt;
  &lt;/bean&gt;
  </code></pre>
  
  <p></p>
  
  <p>My pom.xml:</p>
  
  <pre><code>&lt;project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd"&gt;
    &lt;modelVersion&gt;4.0.0&lt;/modelVersion&gt;
    &lt;groupId&gt;com.kemal&lt;/groupId&gt;
    &lt;artifactId&gt;SpringMVC&lt;/artifactId&gt;
    &lt;packaging&gt;war&lt;/packaging&gt;
    &lt;version&gt;1.0-SNAPSHOT&lt;/version&gt;
    &lt;name&gt;SpringMVC Maven Webapp&lt;/name&gt;
    &lt;url&gt;http://maven.apache.org&lt;/url&gt;
  
    &lt;dependencies&gt;
      &lt;dependency&gt;
        &lt;groupId&gt;junit&lt;/groupId&gt;
        &lt;artifactId&gt;junit&lt;/artifactId&gt;
        &lt;version&gt;3.8.1&lt;/version&gt;
        &lt;scope&gt;test&lt;/scope&gt;
      &lt;/dependency&gt;
  
      &lt;!-- https://mvnrepository.com/artifact/org.springframework/spring-webmvc --&gt;
      &lt;dependency&gt;
        &lt;groupId&gt;org.springframework&lt;/groupId&gt;
        &lt;artifactId&gt;spring-webmvc&lt;/artifactId&gt;
        &lt;version&gt;4.3.9.RELEASE&lt;/version&gt;
      &lt;/dependency&gt;
  
      &lt;!-- https://mvnrepository.com/artifact/org.springframework/spring-context --&gt;
      &lt;dependency&gt;
        &lt;groupId&gt;org.springframework&lt;/groupId&gt;
        &lt;artifactId&gt;spring-context&lt;/artifactId&gt;
        &lt;version&gt;4.3.9.RELEASE&lt;/version&gt;
      &lt;/dependency&gt;
  
      &lt;!-- https://mvnrepository.com/artifact/javax.servlet/jstl --&gt;
      &lt;dependency&gt;
        &lt;groupId&gt;javax.servlet&lt;/groupId&gt;
        &lt;artifactId&gt;jstl&lt;/artifactId&gt;
        &lt;version&gt;1.2&lt;/version&gt;
      &lt;/dependency&gt;
  
  
    &lt;/dependencies&gt;
  
    &lt;build&gt;
      &lt;finalName&gt;SpringMVC&lt;/finalName&gt;
    &lt;/build&gt;
  &lt;/project&gt;
  </code></pre>
  
  <p>IntelliJ can connect controller class with jsp files referenced in handler methods, but I think server can't find jsp. What am I missing? I can't find a solution right now. </p>
  
  <p>Project structure and facets:
  <a href="https://i.stack.imgur.com/KyTfK.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/KyTfK.png" alt="enter image description here"></a>
  <a href="https://i.stack.imgur.com/sj7MS.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/sj7MS.png" alt="enter image description here"></a></p>
  
  <p><a href="https://i.stack.imgur.com/Jb63z.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/Jb63z.png" alt="Project structure"></a></p>