title: Can not access deployed WAR file on Tomcat
body: <p>I have a Spring boot rest service project which works on my local machine. When I run the application as "Spring Boot App"</p>
  
  <p>I can access the rest service by going to </p>
  
  <p><a href="http://127.0.0.1:8080/persons/all" rel="nofollow noreferrer">http://127.0.0.1:8080/persons/all</a></p>
  
  <p>and it returns JSON as it's supposed to. </p>
  
  <p>I changed the pom.xml packaging to war, I then created a war by going to Run as -> Maven build in Spring tools suit. It creates a war file. When I upload the war file on <a href="http://myserverip:8080/manager/" rel="nofollow noreferrer">http://myserverip:8080/manager/</a> I get no errors and it shows up under Applications</p>
  
  <p>The war file name is "myapp-0.0.1-SNAPSHOT.war" after uploading it, I tried to access it by going to</p>
  
  <p><a href="http://myserverip:8080/myapp-0.0.1-SNAPSHOT/persons/all" rel="nofollow noreferrer">http://myserverip:8080/myapp-0.0.1-SNAPSHOT/persons/all</a></p>
  
  <p>But I get a 404 error</p>
  
  <p>What am I doing wrong here?</p>
  
  <p>my pom.xml</p>
  
  <pre><code>&lt;?xml version="1.0" encoding="UTF-8"?&gt;
  &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.mycompany&lt;/groupId&gt;
      &lt;artifactId&gt;myapp&lt;/artifactId&gt;
      &lt;version&gt;0.0.1-SNAPSHOT&lt;/version&gt;
  
      &lt;name&gt;myapp&lt;/name&gt;
      &lt;description&gt;myappapi&lt;/description&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.2.RELEASE&lt;/version&gt;
          &lt;relativePath /&gt; &lt;!-- lookup parent from repository --&gt;
      &lt;/parent&gt;
  
      &lt;properties&gt;
          &lt;project.build.sourceEncoding&gt;UTF-8&lt;/project.build.sourceEncoding&gt;
          &lt;project.reporting.outputEncoding&gt;UTF-8&lt;/project.reporting.outputEncoding&gt;
          &lt;java.version&gt;1.8&lt;/java.version&gt;
      &lt;/properties&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-test&lt;/artifactId&gt;
              &lt;scope&gt;test&lt;/scope&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;
  
      &lt;build&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;packaging&gt;war&lt;/packaging&gt;
  &lt;/project&gt;
  </code></pre>
  
  <p>When I build the application, I get the following logs</p>
  
  <pre><code>[INFO] Scanning for projects...
  [INFO]                                                                         
  [INFO] ------------------------------------------------------------------------
  [INFO] Building myapp 0.0.1-SNAPSHOT
  [INFO] ------------------------------------------------------------------------
  [INFO] 
  [INFO] --- maven-resources-plugin:2.6:resources (default-resources) @ myapp ---
  [INFO] Using 'UTF-8' encoding to copy filtered resources.
  [INFO] Copying 1 resource
  [INFO] Copying 0 resource
  [INFO] 
  [INFO] --- maven-compiler-plugin:3.1:compile (default-compile) @ myapp ---
  [INFO] Nothing to compile - all classes are up to date
  [INFO] 
  [INFO] --- maven-resources-plugin:2.6:testResources (default-testResources) @ myapp ---
  [INFO] Not copying test resources
  [INFO] 
  [INFO] --- maven-compiler-plugin:3.1:testCompile (default-testCompile) @ myapp ---
  [INFO] Not compiling test sources
  [INFO] 
  [INFO] --- maven-surefire-plugin:2.18.1:test (default-test) @ myapp ---
  [INFO] Tests are skipped.
  [INFO] 
  [INFO] --- maven-war-plugin:2.6:war (default-war) @ myapp ---
  [INFO] Packaging webapp
  [INFO] Assembling webapp [myapp] in [C:\Users\me\Documents\workspace-sts-3.8.2.RELEASE\myapp\target\myapp-0.0.1-SNAPSHOT]
  [INFO] Processing war project
  [INFO] Webapp assembled in [586 msecs]
  [INFO] Building war: C:\Users\me\Documents\workspace-sts-3.8.2.RELEASE\myapp\target\myapp-0.0.1-SNAPSHOT.war
  [INFO] 
  [INFO] --- spring-boot-maven-plugin:1.4.2.RELEASE:repackage (default) @ myapp ---
  [INFO] ------------------------------------------------------------------------
  [INFO] BUILD SUCCESS
  [INFO] ------------------------------------------------------------------------
  [INFO] Total time: 3.300 s
  [INFO] Finished at: 2016-11-21T10:12:03-05:00
  [INFO] Final Memory: 20M/243M
  [INFO] ------------------------------------------------------------------------
  [WARNING] The requested profile "pom.xml" could not be activated because it does not exist.
  </code></pre>
  
  <p>my MyappApplication.java</p>
  
  <pre><code>package com.mycompany;
  
  import org.springframework.boot.SpringApplication;
  import org.springframework.boot.autoconfigure.EnableAutoConfiguration;
  import org.springframework.context.annotation.ComponentScan;
  import org.springframework.context.annotation.Configuration;
  
  @Configuration
  @EnableAutoConfiguration
  @ComponentScan
  public class MyappApplication {
      public static void main(String[] args) {
          SpringApplication.run(MyappApplication.class, args);
      }
  }
  </code></pre>