title: Whitelabel error when running with jar file, but works fine with war file and when run with command mvn spring-boot:run
body: <hr />
  <p>I have a spring boot project which works fine on STS and there were no errors or warning when I created the jar file. But, when I run the project through the command line using the command java -jar project.jar and access through a browser, I get Whitelabel error.</p>
  <p><a href="https://i.stack.imgur.com/NVZNb.png" rel="nofollow noreferrer"><strong>Below is the error</strong></a></p>
  <p>I then run the project using maven command, mvn spring-boot:run, it went well again. There were no errors. I have searched for similar problems on stack overflow, I modified prefix and suffix of my jsp pages, but it still does not work. I wrote a print statement in my function to check if the controller is actually hit and found out that, it is actually able to hit the API and print the statement inside the method, but failing to identify the jsp page.</p>
  <p>Please help me identify the mistake I am making, and why it works for maven command, and why not with a jar file or does it make any difference if I run through war file. Here are some of the code details:</p>
  <p><strong>POM FILE</strong></p>
  <pre><code>&lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot;?&gt;
  &lt;project xmlns=&quot;http://maven.apache.org/POM/4.0.0&quot; xmlns:xsi=&quot;http://www.w3.org/2001/XMLSchema- 
  instance&quot;
  xsi:schemaLocation=&quot;http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd&quot;&gt;
  &lt;modelVersion&gt;4.0.0&lt;/modelVersion&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.3.1.RELEASE&lt;/version&gt;
      &lt;relativePath/&gt; &lt;!-- lookup parent from repository --&gt;
  &lt;/parent&gt;
  &lt;groupId&gt;com.project&lt;/groupId&gt;
  &lt;artifactId&gt;Project.V-1.3&lt;/artifactId&gt;
  &lt;version&gt;V-1.3&lt;/version&gt;
  &lt;name&gt;Project&lt;/name&gt;
  &lt;description&gt;Project - Launching on AWS&lt;/description&gt;
  &lt;properties&gt;
      &lt;java.version&gt;1.8&lt;/java.version&gt;
      &lt;spring-cloud.version&gt;Hoxton.SR5&lt;/spring-cloud.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-data-jdbc&lt;/artifactId&gt;
      &lt;/dependency&gt;
  
     &lt;dependency&gt;
   &lt;groupId&gt;com.amazonaws&lt;/groupId&gt;
   &lt;artifactId&gt;aws-java-sdk-s3&lt;/artifactId&gt;
   &lt;/dependency&gt;
  
  &lt;dependency&gt;
  &lt;groupId&gt;org.apache.tomcat&lt;/groupId&gt;
  &lt;artifactId&gt;tomcat-jasper&lt;/artifactId&gt;
  &lt;version&gt;9.0.36&lt;/version&gt;
  &lt;/dependency&gt;
  
  &lt;dependency&gt;
  &lt;groupId&gt;org.jsoup&lt;/groupId&gt;
  &lt;artifactId&gt;jsoup&lt;/artifactId&gt;
  &lt;version&gt;1.13.1&lt;/version&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;org.apache.poi&lt;/groupId&gt;
  &lt;artifactId&gt;poi-ooxml&lt;/artifactId&gt;
  &lt;version&gt;4.1.2&lt;/version&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-jdbc&lt;/artifactId&gt;
      &lt;/dependency&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-web-services&lt;/artifactId&gt;
      &lt;/dependency&gt;
      &lt;dependency&gt;
          &lt;groupId&gt;org.springframework.boot&lt;/groupId&gt;
          &lt;artifactId&gt;spring-boot-starter-webflux&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;runtime&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;exclusions&gt;
              &lt;exclusion&gt;
                  &lt;groupId&gt;org.junit.vintage&lt;/groupId&gt;
                  &lt;artifactId&gt;junit-vintage-engine&lt;/artifactId&gt;
              &lt;/exclusion&gt;
          &lt;/exclusions&gt;
      &lt;/dependency&gt;
  &lt;/dependencies&gt;
  
  &lt;dependencyManagement&gt;
      &lt;dependencies&gt;
          &lt;dependency&gt;
              &lt;groupId&gt;org.springframework.cloud&lt;/groupId&gt;
              &lt;artifactId&gt;spring-cloud-dependencies&lt;/artifactId&gt;
              &lt;version&gt;${spring-cloud.version}&lt;/version&gt;
              &lt;type&gt;pom&lt;/type&gt;
              &lt;scope&gt;import&lt;/scope&gt;
          &lt;/dependency&gt;
      &lt;/dependencies&gt;
  &lt;/dependencyManagement&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;/plugins&gt;
   &lt;/build&gt;
   &lt;/project&gt;
  </code></pre>
  <p><a href="https://i.stack.imgur.com/hOeEy.png" rel="nofollow noreferrer"><strong>Project directory</strong></a></p>
  <p><strong>Application.properties file</strong></p>
  <pre><code>spring.mvc.view.prefix=/WEB-INF/jsps/
  spring.mvc.view.suffix=.jsp
  </code></pre>
  <p><strong>My Controller</strong></p>
  <pre><code>@Controller
  public class HomeController {
  @RequestMapping(&quot;/&quot;)
  public ModelAndView home() {
      ModelAndView home_model = new ModelAndView();
      System.out.println(&quot;Home Page is hit&quot;);
      home_model.setViewName(&quot;homePage&quot;);
      return home_model;
  } }
  </code></pre>
  <p>I see this below on CMD:</p>
  <p><a href="https://i.stack.imgur.com/H0De6.jpg" rel="nofollow noreferrer">CMD log</a></p>
  <p>But when it shows the White label error on the browser as shown in image 1.</p>