title: Spring boot web app not running on tomcat 9
body: <p>My web App works fine on Eclipse Photon STS, java 8 and Spring Boot 2.02 with the embeded tomcat using endpoint:</p>
  
  <pre><code>http://localhost:8081/DataViewer/tspsPatentSearch
  </code></pre>
  
  <p>But when I compile the code into  DataViewer.war file (using mvn package) and run it on Tomcat 9 on Linux
  with endpoint:</p>
  
  <pre><code>http://myserver.com:8081/DataViewer/tspsPatentSearch
  </code></pre>
  
  <p>I get the infamous:</p>
  
  <pre><code>Whitelabel Error Page
  There was an unexpected error (type=Not Found, status=404).
  /DataViewer/tspsPatentSearch
  </code></pre>
  
  <p>My pom.xml file is: </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/xsd/maven-4.0.0.xsd"&gt;&lt;modelVersion&gt;4.0.0&lt;/modelVersion&gt;
  &lt;groupId&gt;com.clarivate&lt;/groupId&gt;
  &lt;artifactId&gt;dataviewer&lt;/artifactId&gt;
  &lt;version&gt;0.0.1-SNAPSHOT&lt;/version&gt;
  &lt;packaging&gt;war&lt;/packaging&gt;
  
  &lt;name&gt;dataviewer&lt;/name&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;2.0.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;start-class&gt;com.clarivate.dataviewer.DvMain&lt;/start-class&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;exclusions&gt;
                  &lt;exclusion&gt;
                      &lt;groupId&gt;org.springframework.boot&lt;/groupId&gt;
                      &lt;artifactId&gt;spring-boot-starter-tomcat&lt;/artifactId&gt;
                  &lt;/exclusion&gt;
              &lt;/exclusions&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-test&lt;/artifactId&gt;
          &lt;scope&gt;test&lt;/scope&gt;
      &lt;/dependency&gt;
  
      &lt;!-- DS may need to remove for tomcat installation --&gt;
      &lt;dependency&gt;
          &lt;groupId&gt;org.springframework&lt;/groupId&gt;
          &lt;artifactId&gt;spring-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-log4j2&lt;/artifactId&gt;
          &lt;exclusions&gt;
              &lt;exclusion&gt;
                  &lt;groupId&gt;org.apache.logging.log4j&lt;/groupId&gt;
                  &lt;artifactId&gt;log4j-slf4j-impl&lt;/artifactId&gt;
              &lt;/exclusion&gt;
          &lt;/exclusions&gt;
      &lt;/dependency&gt;
  
     &lt;dependency&gt;
          &lt;groupId&gt;org.apache.tomcat.embed&lt;/groupId&gt;
          &lt;artifactId&gt;tomcat-embed-jasper&lt;/artifactId&gt;
          &lt;scope&gt;provided&lt;/scope&gt;
      &lt;/dependency&gt;
  
      &lt;dependency&gt;
          &lt;groupId&gt;javax.servlet&lt;/groupId&gt;
          &lt;artifactId&gt;jstl&lt;/artifactId&gt;
      &lt;/dependency&gt;
  
      &lt;dependency&gt;
          &lt;groupId&gt;com.oracle&lt;/groupId&gt;
          &lt;artifactId&gt;ojdbc6&lt;/artifactId&gt;
          &lt;version&gt;11.2.0.1.0&lt;/version&gt;
      &lt;/dependency&gt;
  
  
      &lt;dependency&gt;
          &lt;groupId&gt;org.springframework.boot&lt;/groupId&gt;
          &lt;artifactId&gt;spring-boot-starter-jdbc&lt;/artifactId&gt;
      &lt;/dependency&gt;
      &lt;dependency&gt;
          &lt;groupId&gt;com.h2database&lt;/groupId&gt;
          &lt;artifactId&gt;h2&lt;/artifactId&gt;
          &lt;scope&gt;test&lt;/scope&gt;
      &lt;/dependency&gt;
  
  &lt;/dependencies&gt;
  
     &lt;!-- Required to find ojdbc6, because Oracle don't make it available to maven--&gt;
      &lt;repositories&gt;
          &lt;repository&gt;
            &lt;id&gt;codelds&lt;/id&gt;
            &lt;url&gt;https://code.lds.org/nexus/content/groups/main-repo&lt;/url&gt;
          &lt;/repository&gt;
        &lt;/repositories&gt;
  
  &lt;build&gt;
      &lt;finalName&gt;DataViewer&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;configuration&gt;
                  &lt;mainClass&gt;com.clarivate.dataviewer.DvMain&lt;/mainClass&gt;
              &lt;/configuration&gt;    
          &lt;/plugin&gt;
      &lt;/plugins&gt;
  &lt;/build&gt;
  
  
  &lt;description&gt;TSPS data viewer&lt;/description&gt;
  </code></pre>
  
  <p></p>
  
  <p>In application.properties I have:</p>
  
  <pre><code>spring.mvc.view.prefix=/WEB-INF/jsp/
  spring.mvc.view.suffix=.jsp
  server.servlet.path=/DataViewer 
  </code></pre>
  
  <p>My main class is:</p>
  
  <pre><code>package com.clarivate.dataviewer;
  import org.apache.logging.log4j.Logger;
  import org.apache.logging.log4j.LogManager;
  import org.springframework.boot.SpringApplication;
  import org.springframework.boot.autoconfigure.SpringBootApplication;
  import org.springframework.boot.builder.SpringApplicationBuilder;
  import org.springframework.boot.web.servlet.support.SpringBootServletInitializer;
  
  @SpringBootApplication
  
  public class DvMain extends SpringBootServletInitializer {
  
      static Logger logger = LogManager.getRootLogger();
  
      public static void main(String[] args) {
          logger.debug("DS1A in main()");
          SpringApplication.run(DvMain.class, args);
          logger.info("DS1C finished.");
      }
  
  
      //@Override
      protected SpringApplicationBuilder configure(SpringApplicationBuilder builder) {
          return builder.sources(DvMain.class);
       }  
  }
  </code></pre>
  
  <p>My MainController.java has:</p>
  
  <pre><code>@GetMapping("/tspsPatentSearch")
  public String tspsPatentSearch(Model model) {
       model.addAttribute("tspsPatent", new TspsPatent());
  
       return "tspsPatentSearch";                 
  }
  </code></pre>
  
  <p>The war file unpacks fine and there are no errors. In catalina.out we have:</p>
  
  <pre><code>2018-10-04 12:09:09.954  INFO 12950 --- [           main] s.w.s.m.m.a.RequestMappingHandlerMapping : Mapped "{[/tspsPatentSearch],methods=[POST]}" onto public java.lang.String com.clarivate.dataviewer.controller.MainController.tspsPatentSearch(com.clarivate.dataviewer.model.TspsPatent,org.springframework.ui.Model,org.springframework.validation.BindingResult)
  </code></pre>
  
  <p>and no errors. I've tried <a href="https://stackoverflow.com/questions/36819277/issue-with-spring-there-was-an-unexpected-error-type-not-found-status-404">this</a> ie my package structure is correct and <a href="https://stackoverflow.com/questions/36482203/whitelabel-error-page-there-was-an-unexpected-error-type-not-found-status-404">this</a> ie my jsp's are in the correct location (data_viewer\src\main\webapp\WEB-INF\jsp)
  and i'm now running short of ideas. Any help much appreciated</p>
  
  <p>Edit: If I copy tspsPatentSearch.jsp into the war file top directory then tomcat finds it. So it looks like tomcat is ignoring:</p>
  
  <pre><code>spring.mvc.view.prefix=/WEB-INF/jsp/
  </code></pre>
  
  <p>or not finding application.properties at all.</p>