title: 404 Not found Spring boot war to Tomcat
body: <p>I have Spring boot applicatio. This works fine with embedded server. And i can use Postman to test API. </p>
  
  <p>Now i want deploy this on Tomcat 8 i create root.war file with <code>maven install</code>
  and put it to Tomcat/webapps/ 
  I run tomcat without any errors. But when i use the same url as postman it gives me 404 not found.</p>
  
  <p>Example of url i use for both(embedded and tomcat): <code>localhost:8080/auth/registration</code></p>
  
  <p>I've tried to set <code>server.context-path</code> in application.properties but no result. </p>
  
  <p>I believe that problem is in configuration of project. </p>
  
  <p>Here is my pom.xml</p>
  
  <pre><code>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.3.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;/dependency&gt;
      &lt;dependency&gt;
          &lt;groupId&gt;org.springframework.boot&lt;/groupId&gt;
          &lt;artifactId&gt;spring-boot-starter-data-jpa&lt;/artifactId&gt;
      &lt;/dependency&gt;
      &lt;dependency&gt;
          &lt;groupId&gt;org.springframework.boot&lt;/groupId&gt;
          &lt;artifactId&gt;spring-boot-starter-security&lt;/artifactId&gt;
      &lt;/dependency&gt;
      &lt;dependency&gt;
          &lt;groupId&gt;org.springframework.boot&lt;/groupId&gt;
          &lt;artifactId&gt;spring-boot-configuration-processor&lt;/artifactId&gt;
          &lt;optional&gt;true&lt;/optional&gt;
      &lt;/dependency&gt;
      &lt;dependency&gt;
          &lt;groupId&gt;io.jsonwebtoken&lt;/groupId&gt;
          &lt;artifactId&gt;jjwt&lt;/artifactId&gt;
          &lt;version&gt;0.7.0&lt;/version&gt;
      &lt;/dependency&gt;
      &lt;dependency&gt;
          &lt;groupId&gt;org.apache.tika&lt;/groupId&gt;
          &lt;artifactId&gt;tika-core&lt;/artifactId&gt;
          &lt;version&gt;1.14&lt;/version&gt;
      &lt;/dependency&gt;
      &lt;dependency&gt;
          &lt;groupId&gt;org.apache.httpcomponents&lt;/groupId&gt;
          &lt;artifactId&gt;httpclient&lt;/artifactId&gt;
      &lt;/dependency&gt;
  
      &lt;dependency&gt;
          &lt;groupId&gt;io.springfox&lt;/groupId&gt;
          &lt;artifactId&gt;springfox-swagger-ui&lt;/artifactId&gt;
          &lt;version&gt;2.8.0&lt;/version&gt;
      &lt;/dependency&gt;
      &lt;dependency&gt;
          &lt;groupId&gt;commons-fileupload&lt;/groupId&gt;
          &lt;artifactId&gt;commons-fileupload&lt;/artifactId&gt;
          &lt;version&gt;1.3.2&lt;/version&gt;
      &lt;/dependency&gt;
      &lt;dependency&gt;
          &lt;groupId&gt;io.springfox&lt;/groupId&gt;
          &lt;artifactId&gt;springfox-swagger2&lt;/artifactId&gt;
          &lt;version&gt;2.8.0&lt;/version&gt;
      &lt;/dependency&gt;
  
      &lt;!--Dependency for singleton--&gt;
      &lt;dependency&gt;
          &lt;groupId&gt;javax.ejb&lt;/groupId&gt;
          &lt;artifactId&gt;javax.ejb-api&lt;/artifactId&gt;
          &lt;version&gt;3.2&lt;/version&gt;
      &lt;/dependency&gt;
  
  
      &lt;!--PostgreSQL driver--&gt;
      &lt;dependency&gt;
          &lt;groupId&gt;org.postgresql&lt;/groupId&gt;
          &lt;artifactId&gt;postgresql&lt;/artifactId&gt;
          &lt;scope&gt;runtime&lt;/scope&gt;
      &lt;/dependency&gt;
  
  
      &lt;dependency&gt;
          &lt;groupId&gt;javax.xml.bind&lt;/groupId&gt;
          &lt;artifactId&gt;jaxb-api&lt;/artifactId&gt;
          &lt;version&gt;2.3.0&lt;/version&gt;
      &lt;/dependency&gt;
  
      &lt;!--SEND MAIL--&gt;
      &lt;dependency&gt;
          &lt;groupId&gt;org.springframework.boot&lt;/groupId&gt;
          &lt;artifactId&gt;spring-boot-starter-mail&lt;/artifactId&gt;
      &lt;/dependency&gt;
  
      &lt;dependency&gt;
          &lt;groupId&gt;org.apache.tomcat&lt;/groupId&gt;
          &lt;artifactId&gt;tomcat-servlet-api&lt;/artifactId&gt;
          &lt;version&gt;7.0.21&lt;/version&gt;
          &lt;scope&gt;provided&lt;/scope&gt;
      &lt;/dependency&gt;
  
      &lt;!--Amazon--&gt;
      &lt;dependency&gt;
          &lt;groupId&gt;com.amazonaws&lt;/groupId&gt;
          &lt;artifactId&gt;aws-java-sdk&lt;/artifactId&gt;
          &lt;version&gt;1.11.331&lt;/version&gt;
      &lt;/dependency&gt;
  
      &lt;dependency&gt;
          &lt;groupId&gt;log4j&lt;/groupId&gt;
          &lt;artifactId&gt;log4j&lt;/artifactId&gt;
          &lt;version&gt;1.2.17&lt;/version&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;javax.servlet&lt;/groupId&gt;
          &lt;artifactId&gt;servlet-api&lt;/artifactId&gt;
          &lt;version&gt;2.5&lt;/version&gt;
      &lt;/dependency&gt;
      &lt;dependency&gt;
          &lt;groupId&gt;commons-io&lt;/groupId&gt;
          &lt;artifactId&gt;commons-io&lt;/artifactId&gt;
          &lt;version&gt;2.5&lt;/version&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;configuration&gt;
                  &lt;executable&gt;true&lt;/executable&gt;
              &lt;/configuration&gt;
          &lt;/plugin&gt;
          &lt;plugin&gt;
              &lt;groupId&gt;org.apache.maven.plugins&lt;/groupId&gt;
              &lt;artifactId&gt;maven-compiler-plugin&lt;/artifactId&gt;
              &lt;configuration&gt;
                  &lt;source&gt;1.8&lt;/source&gt;
                  &lt;target&gt;1.8&lt;/target&gt;
              &lt;/configuration&gt;
          &lt;/plugin&gt;
  
  
      &lt;/plugins&gt;
      &lt;finalName&gt;ROOT&lt;/finalName&gt;
  &lt;/build&gt;
  
  &lt;repositories&gt;
      &lt;repository&gt;
          &lt;id&gt;spring-releases&lt;/id&gt;
          &lt;url&gt;https://repo.spring.io/libs-release&lt;/url&gt;
      &lt;/repository&gt;
  &lt;/repositories&gt;
  &lt;pluginRepositories&gt;
      &lt;pluginRepository&gt;
          &lt;id&gt;spring-releases&lt;/id&gt;
          &lt;url&gt;https://repo.spring.io/libs-release&lt;/url&gt;
      &lt;/pluginRepository&gt;
  &lt;/pluginRepositories&gt;
  </code></pre>
  
  <p><strong>EDITED</strong></p>
  
  <p>Also i have found that spring boot can be compiled to JAR as better way than war. If it's better how to change pom.xml for compiling in jar.</p>
  
  <p>So i've tried to create jar as suggested below. I run this with <code>java -jar</code> and got
  <code>org.springframework.context.ApplicationContextException: Unable to start embedded container; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'tomcatEmbeddedServletContainerFactory' defined in class path resource [org/springframework/boot/autoconfigure/web/EmbeddedServletContainerAutoConfiguration$EmbeddedTomcat.class]: Initialization of bean failed; nested exception is org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'org.springframework.boot.autoconfigure.web.HttpEncodingAutoConfiguration': Unsatisfied dependency expressed through constructor parameter 0; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'spring.http.encoding-org.springframework.boot.autoconfigure.web.HttpEncodingProperties': Initialization of bean failed; nested exception is java.lang.NoClassDefFoundError: javax/xml/bind/ValidationException</code> </p>
  
  <pre><code>     Caused by: java.lang.ClassNotFoundException: javax.xml.bind.ValidationException
  at java.base/java.net.URLClassLoader.findClass(Unknown Source) ~[na:na]
  at java.base/java.lang.ClassLoader.loadClass(Unknown Source) ~[na:na]
  at org.springframework.boot.loader.LaunchedURLClassLoader.loadClass(LaunchedURLClassLoader.java:94) ~[rehapp-api.jar:1.0-SNAPSHOT]
  at java.base/java.lang.ClassLoader.loadClass(Unknown Source) ~[na:na]
  ... 83 common frames omitted
  </code></pre>