title: Spring Boot War deployed to Tomcat
body: <p>I am trying to deploy a Spring Boot app to Tomcat, because I want to deploy to AWS.
  I created a WAR file, but it does not seem to run on Tomcat, even though it is visible.</p>
  
  <p>Details:<br>
  0. Here is my app:</p>
  
  <pre><code>@Configuration
  @ComponentScan
  @EnableAutoConfiguration
  public class App {
      public static void main(String[] args) {
          SpringApplication.run(SampleController.class, args);
      }
  }
  
  @Controller
  @EnableAutoConfiguration
  public class SampleController {
      @RequestMapping("/help")
      @ResponseBody
      String home() {
          String input = "Hi! Please use 'tag','check' and 'close' resources.";
          return input;
      }
  }
  </code></pre>
  
  <p>application.properties has following:</p>
  
  <pre><code>server.port=${port:7777}
  </code></pre>
  
  <ol>
  <li><p>After reading a number of <a href="http://docs.spring.io/spring-boot/docs/current-SNAPSHOT/reference/htmlsingle/#build-tool-plugins-maven-packaging" rel="noreferrer">pages</a> and <a href="https://stackoverflow.com/questions/24741816/deploy-spring-boot-to-tomcat">question-answers</a> I added following to my POM:</p>
  
  <p>
  http://maven.apache.org/xsd/maven-4.0.0.xsd">
      4.0.0</p>
  
  <pre><code>&lt;groupId&gt;com.niewlabs&lt;/groupId&gt;
  &lt;artifactId&gt;highlighter&lt;/artifactId&gt;
  &lt;version&gt;1.0-SNAPSHOT&lt;/version&gt;
  
  &lt;packaging&gt;war&lt;/packaging&gt;
  
  &lt;properties&gt;
      &lt;java.version&gt;1.8&lt;/java.version&gt;
  &lt;/properties&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.1.9.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;/dependencies&gt;
  </code></pre>
  
  <p></p></li>
  <li><p>I ran"mvn package"and got WAR file (size 250Mb), which I put into "webapps" folder.</p></li>
  <li>I started Tomcat and am able to see my app listed, in my case "/highlighter-1.0-SNAPSHOT".</li>
  <li>Clicking on the link for the app results in "Status 404" page.</li>
  <li>When I run Spring Boot app just by itself, without container it runs on localhost:7777, but there is nothing there when I run it in Tomcat. </li>
  </ol>
  
  <p>Update:
  There is another <a href="http://docs.spring.io/spring-boot/docs/current/reference/htmlsingle/#howto-create-a-deployable-war-file" rel="noreferrer">reference</a>. Not sure how useful it is.</p>