title: Spring Boot application gives 404 when deployed to Tomcat but works with embedded server
body: <p>Guided by <a href="https://spring.io/guides/gs/serving-web-content/" rel="noreferrer">Serving Web Content with Spring MVC</a>, I'm creating a Spring Boot web application that I can run using both the embedded Tomcat instance as well as on a standalone Tomcat 8 server.</p>
  
  <p>The application works as expected when executed as <code>java -jar adminpage.war</code> and I see the expected outcome when I visit <code>http://localhost:8080/table</code>. However, when I deploy to a Tomcat 8 server (by dropping <code>adminpage.war</code> into the <code>webapps</code> directory), I get a 404 error when I visit <code>https://myserver/adminpage/table</code>.</p>
  
  <p>The <code>catelina.log</code> and <code>localhost.log</code> files contain nothing helpful on the Tomcat server.</p>
  
  <p>Can anyone suggest where I've made a misconfiguration? I've not had the same problems in the past when deploying RESTful services with Spring Boot, but this is my first foray into a web application.</p>
  
  <p>My application files:</p>
  
  <p><code>src/main/java/com/.../Application.java</code></p>
  
  <pre><code>@SpringBootApplication
  public class Application {
      public static void main(String[] args) {
          SpringApplication.run(Application.class, args);
      }
  
  }
  </code></pre>
  
  <p><code>src/main/java/com/.../MainController.java</code></p>
  
  <pre><code>@Controller
  public class MainController {
  
      @RequestMapping("/table")
      public String greeting(Model model) {
          model.addAttribute("name", "Fooballs");
          return "table";
      }
  }
  </code></pre>
  
  <p><code>src/main/resources/templates/table.html</code></p>
  
  <pre class="lang-html prettyprint-override"><code>&lt;!DOCTYPE HTML&gt;
  &lt;html xmlns:th="http://www.thymeleaf.org"&gt;
  &lt;head&gt;
      &lt;meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /&gt;
  &lt;/head&gt;
  &lt;body&gt;
      &lt;p th:text="'Hello, ' + ${name} + '!'" /&gt;
  &lt;/body&gt;
  &lt;/html&gt;
  </code></pre>
  
  <p><code>pom.xml</code></p>
  
  <pre class="lang-xml prettyprint-override"><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/xsd/maven-4.0.0.xsd"&gt;
    &lt;modelVersion&gt;4.0.0&lt;/modelVersion&gt;
    &lt;groupId&gt;com.foo&lt;/groupId&gt;
    &lt;artifactId&gt;adminpage&lt;/artifactId&gt;
    &lt;version&gt;1.0-SNAPSHOT&lt;/version&gt;
    &lt;packaging&gt;war&lt;/packaging&gt;
  
    &lt;parent&gt;
      &lt;groupId&gt;org.springframework.boot&lt;/groupId&gt;
      &lt;artifactId&gt;spring-boot-starter-parent&lt;/artifactId&gt;
      &lt;version&gt;1.4.0.RELEASE&lt;/version&gt;
    &lt;/parent&gt;
  
    &lt;dependencies&gt;
      &lt;dependency&gt;
        &lt;groupId&gt;org.springframework.boot&lt;/groupId&gt;
        &lt;artifactId&gt;spring-boot-starter-web&lt;/artifactId&gt;
      &lt;/dependency&gt;
      &lt;dependency&gt;
        &lt;groupId&gt;org.springframework.boot&lt;/groupId&gt;
        &lt;artifactId&gt;spring-boot-starter-tomcat&lt;/artifactId&gt;
        &lt;scope&gt;provided&lt;/scope&gt;
      &lt;/dependency&gt;
      &lt;dependency&gt;
        &lt;groupId&gt;org.springframework.boot&lt;/groupId&gt;
        &lt;artifactId&gt;spring-boot-starter-thymeleaf&lt;/artifactId&gt;
      &lt;/dependency&gt;
      &lt;dependency&gt;
        &lt;groupId&gt;org.springframework.boot&lt;/groupId&gt;
        &lt;artifactId&gt;spring-boot-devtools&lt;/artifactId&gt;
        &lt;optional&gt;true&lt;/optional&gt;
      &lt;/dependency&gt;
    &lt;/dependencies&gt;
  
    &lt;properties&gt;
      &lt;java.version&gt;1.8&lt;/java.version&gt;
      &lt;project.build.sourceEncoding&gt;UTF-8&lt;/project.build.sourceEncoding&gt;
    &lt;/properties&gt;
  
  
    &lt;build&gt;
      &lt;finalName&gt;adminpage&lt;/finalName&gt;
  
      &lt;plugins&gt;
        &lt;plugin&gt;
          &lt;groupId&gt;org.springframework.boot&lt;/groupId&gt;
          &lt;artifactId&gt;spring-boot-maven-plugin&lt;/artifactId&gt;
        &lt;/plugin&gt;
      &lt;/plugins&gt;
    &lt;/build&gt;
  
  &lt;/project&gt;
  </code></pre>