title: Getting issue while deploying spring boot war on tomcat 7
body: <p>I am having issue in deploying my code on the tomcat server
  I have written the below code.</p>
  
  <p>My main class:</p>
  
  <pre><code>package com.indiamart.search;
  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 SuggestMcatApplication  extends SpringBootServletInitializer{
  
      public static void main(String[] args) {
          SpringApplication.run(SuggestMcatApplication.class, args);
      }
  
      @Override
      protected SpringApplicationBuilder configure(SpringApplicationBuilder builder) {
          // TODO Auto-generated method stub
          return builder.sources(SuggestMcatApplication.class);
      }}
  </code></pre>
  
  <p>My controller class :-</p>
  
  <pre><code>package com.abc.search;
  import java.util.HashMap;
  import java.util.Map;
  import javax.servlet.http.HttpServletRequest;
  
  import org.json.JSONObject;
  import org.springframework.web.bind.annotation.RequestMapping;
  import org.springframework.web.bind.annotation.RequestParam;
  import org.springframework.web.bind.annotation.RestController;
  
  
  @RestController
  public class serviceController {
  
      @RequestMapping("/suggestMcat/related_info")
  
      public String getSearchString(HttpServletRequest request){
          JSONObject json;
          json =  new JSONObject(request);
          return json.toString();
      }
      }
  </code></pre>
  
  <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.abc&lt;/groupId&gt;
  &lt;artifactId&gt;suggestMcat&lt;/artifactId&gt;
  &lt;version&gt;0.0.1-SNAPSHOT&lt;/version&gt;
  &lt;packaging&gt;war&lt;/packaging&gt;
  &lt;name&gt;suggestMcat&lt;/name&gt;
  &lt;description&gt;Demo project for Spring Boot&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;2.1.1.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-web&lt;/artifactId&gt;
  &lt;/dependency&gt;
  &lt;!-- https://mvnrepository.com/artifact/org.json/json --&gt;
  &lt;dependency&gt;
  &lt;groupId&gt;org.json&lt;/groupId&gt;
  &lt;artifactId&gt;json&lt;/artifactId&gt;
  &lt;version&gt;20171018&lt;/version&gt;
  &lt;/dependency&gt;
  &lt;!-- https://mvnrepository.com/artifact/net.sf.jazzy/jazzy --&gt;
  &lt;dependency&gt;
  &lt;groupId&gt;net.sf.jazzy&lt;/groupId&gt;
  &lt;artifactId&gt;jazzy&lt;/artifactId&gt;
  &lt;version&gt;0.5.2-rtext-1.4.1&lt;/version&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;/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;plugin&gt;
  &lt;artifactId&gt;maven-compiler-plugin&lt;/artifactId&gt;
  &lt;version&gt;3.0&lt;/version&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;plugin&gt;
  &lt;groupId&gt;org.apache.maven.plugins&lt;/groupId&gt;
  &lt;artifactId&gt;maven-war-plugin&lt;/artifactId&gt;
  &lt;version&gt;3.0.0&lt;/version&gt;
  &lt;configuration&gt;
      &lt;outputDirectory&gt;../../tomcat/webapps/&lt;/outputDirectory&gt;
      &lt;failOnMissingWebXml&gt;false&lt;/failOnMissingWebXml&gt;
      &lt;warName&gt;${project.artifactId}&lt;/warName&gt;
  &lt;/configuration&gt;
  &lt;/plugin&gt;
  &lt;plugin&gt;
  &lt;groupId&gt;org.apache.maven.plugins&lt;/groupId&gt;
  &lt;artifactId&gt;maven-install-plugin&lt;/artifactId&gt;
  &lt;executions&gt;
      &lt;execution&gt;
          &lt;id&gt;install-javaml-jar&lt;/id&gt;
          &lt;phase&gt;clean&lt;/phase&gt;
          &lt;configuration&gt;
              &lt;file&gt;${project.basedir}/src/main/resources/javaml-0.1.6.jar&lt;/file&gt;
              &lt;repositoryLayout&gt;default&lt;/repositoryLayout&gt;
              &lt;groupId&gt;com.indiamart&lt;/groupId&gt;
              &lt;artifactId&gt;javaml&lt;/artifactId&gt;
              &lt;version&gt;0.1.6&lt;/version&gt;
              &lt;packaging&gt;jar&lt;/packaging&gt;
              &lt;generatePom&gt;true&lt;/generatePom&gt;
          &lt;/configuration&gt;
          &lt;goals&gt;
              &lt;goal&gt;install-file&lt;/goal&gt;
          &lt;/goals&gt;
      &lt;/execution&gt;
      &lt;execution&gt;
          &lt;id&gt;install-ajt-jar&lt;/id&gt;
          &lt;phase&gt;clean&lt;/phase&gt;
          &lt;configuration&gt;
              &lt;file&gt;${project.basedir}/src/main/resources/ajt-2.11.jar&lt;/file&gt;
              &lt;repositoryLayout&gt;default&lt;/repositoryLayout&gt;
              &lt;groupId&gt;com.indiamart&lt;/groupId&gt;
              &lt;artifactId&gt;ajt&lt;/artifactId&gt;
              &lt;version&gt;2.11&lt;/version&gt;
              &lt;packaging&gt;jar&lt;/packaging&gt;
              &lt;generatePom&gt;true&lt;/generatePom&gt;
          &lt;/configuration&gt;
          &lt;goals&gt;
              &lt;goal&gt;install-file&lt;/goal&gt;
          &lt;/goals&gt;
      &lt;/execution&gt;
  &lt;/executions&gt;
  &lt;/plugin&gt;   
  &lt;/plugins&gt;
  &lt;finalName&gt;${project.artifactId}&lt;/finalName&gt;
  &lt;/build&gt;
  &lt;/project&gt;
  </code></pre>
  
  <p>I m getting the below error when i m building the war and deploying on tomcat server:</p>
  
  <pre><code>Caused by: java.lang.NoClassDefFoundError: org/springframework/web/filter/FormContentFilter
              at java.base/java.lang.ClassLoader.defineClass1(Native Method) ~[na:na]
              at java.base/java.lang.ClassLoader.defineClass(ClassLoader.java:1009)
  2018-12-04 17:59:39.859  WARN 14727 --- [io-8080-exec-29] o.s.boot.SpringApplication               : Unable to close
       ApplicationContext
  
           java.lang.IllegalStateException: Failed to introspect Class [org.springframework.boot.autoconfigure.web.servlet.WebMvcAutoConfiguration]
       from ClassLoader [WebappClassLoader
             context: /suggestMcat
             delegate: false
             repositories:
               /WEB-INF/classes/
           ---------- Parent Classloader:
           java.net.URLClassLoader@3dd4520b
  </code></pre>
  
  <p>Please suggest.</p>
  
  <p>After the answer 2 my issue has been resolved of deploying but the issue is coming with controller
  Whitelabel Error Page
  This application has no explicit mapping for /error, so you are seeing this as a fallback.</p>
  
  <p>Tue Dec 04 21:36:49 IST 2018
  There was an unexpected error (type=Not Found, status=404).
  No message available</p>