title: Error creating bean 'org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter#1'
body: <p>I'm trying to create a web-app, using Maven and Intellij Idea. Tests work fine as installing in .war-file. But when I try to refer to my rest with jetty, I have lots of error cases:</p>
  
  <blockquote>
    <p>Error creating bean with name 'org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter#1' defined in ServletContext resource [/WEB-INF/rest-spring.xml]: Initialization of bean failed;
    <br> nested exception is java.lang.NoClassDefFoundError: com/fasterxml/jackson/core/JsonProcessingException</p>
  </blockquote>
  
  <p>Here are rest module files:
  <strong>Web.xml</strong></p>
  
  <pre><code>&lt;web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" version="2.5"
           xmlns="http://java.sun.com/xml/ns/javaee"
           xsi:schemaLocation="http://java.sun.com/xml/ns/javaee
           http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd"&gt;
  
      &lt;servlet&gt;
          &lt;servlet-name&gt;restDispatcherServlet&lt;/servlet-name&gt;
          &lt;servlet-class&gt;org.springframework.web.servlet.DispatcherServlet&lt;/servlet-class&gt;
          &lt;!--the location of the spring context configuration file--&gt;
          &lt;init-param&gt;
              &lt;param-name&gt;contextConfigLocation&lt;/param-name&gt;
              &lt;param-value&gt;/WEB-INF/rest-spring.xml&lt;/param-value&gt;
          &lt;/init-param&gt;
          &lt;load-on-startup&gt;1&lt;/load-on-startup&gt;
      &lt;/servlet&gt;
  
      &lt;servlet-mapping&gt;
          &lt;servlet-name&gt;restDispatcherServlet&lt;/servlet-name&gt;
          &lt;url-pattern&gt;/&lt;/url-pattern&gt;
      &lt;/servlet-mapping&gt;
  &lt;/web-app&gt;
  </code></pre>
  
  <p><strong>rest-spring.xml</strong></p>
  
  <pre><code>&lt;?xml version="1.0" encoding="UTF-8"?&gt;
  &lt;beans xmlns="http://www.springframework.org/schema/beans"
         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
         xmlns:jdbc="http://www.springframework.org/schema/jdbc"
         xmlns:context="http://www.springframework.org/schema/context"
         xmlns:mvc="http://www.springframework.org/schema/mvc"
         xsi:schemaLocation="http://www.springframework.org/schema/beans
         http://www.springframework.org/schema/beans/spring-beans.xsd
         http://www.springframework.org/schema/jdbc
         http://www.springframework.org/schema/jdbc/spring-jdbc.xsd
         http://www.springframework.org/schema/mvc
         http://www.springframework.org/schema/mvc/spring-mvc.xsd
         http://www.springframework.org/schema/context
         http://www.springframework.org/schema/context/spring-context.xsd"&gt;
  
  
      &lt;mvc:annotation-driven/&gt;
  
      &lt;bean class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer"&gt;
          &lt;property name="locations"&gt;
              &lt;list&gt;
                  &lt;value&gt;classpath:model.properties&lt;/value&gt;
                  &lt;value&gt;classpath:database.properties&lt;/value&gt;
                  &lt;value&gt;classpath:automobile.properties&lt;/value&gt;
              &lt;/list&gt;
          &lt;/property&gt;
      &lt;/bean&gt;
  
  
      &lt;bean id="dataSource" class="org.springframework.jdbc.datasource.DriverManagerDataSource"&gt;
          &lt;property name="driverClassName" value="${jdbc.driverClassName}"/&gt;
          &lt;property name="url" value="${jdbc.url}"/&gt;
          &lt;property name="username" value="${jdbc.username}"/&gt;
          &lt;property name="password" value="${jdbc.password}"/&gt;
      &lt;/bean&gt;
  
      &lt;jdbc:initialize-database data-source="dataSource"&gt;
          &lt;jdbc:script location="classpath*:create-tables-model.sql"/&gt;
          &lt;jdbc:script location="classpath*:create-tables-automobile.sql"/&gt;
          &lt;jdbc:script location="classpath*:data-script.sql"/&gt;
      &lt;/jdbc:initialize-database&gt;
  
      &lt;bean id="transactionManager" class="org.springframework.jdbc.datasource.DataSourceTransactionManager"&gt;
          &lt;property name="dataSource" ref="dataSource" /&gt;
      &lt;/bean&gt;
  
      &lt;bean class="org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter"&gt;
          &lt;property name="messageConverters"&gt;
              &lt;list&gt;
                  &lt;ref bean="jsonConverter"/&gt;
              &lt;/list&gt;
          &lt;/property&gt;
      &lt;/bean&gt;
  
      &lt;bean id="jsonConverter" class="org.springframework.http.converter.json.MappingJackson2HttpMessageConverter"&gt;
          &lt;property name="supportedMediaTypes" value="application/json" /&gt;
          &lt;property name="prettyPrint" value="true" /&gt;
      &lt;/bean&gt;
  
      &lt;bean id="modelDao" class="com.dao.ModelDaoImpl"&gt;
          &lt;constructor-arg ref="dataSource" /&gt;
      &lt;/bean&gt;
  
      &lt;bean id="automobileDao" class="com.dao.AutomobileDaoImpl"&gt;
          &lt;constructor-arg ref="dataSource" /&gt;
      &lt;/bean&gt;
  
      &lt;bean id="modelService" class="com.service.ModelServiceImpl"&gt;
          &lt;property name = "modelDao" ref = "modelDao"/&gt;
      &lt;/bean&gt;
      &lt;bean id="automobileService" class="com.service.AutomobileServiceImpl"&gt;
          &lt;property name = "automobileDao" ref = "automobileDao"/&gt;
      &lt;/bean&gt;
      &lt;context:component-scan base-package="com.rest"/&gt;
  &lt;/beans&gt;
  </code></pre>
  
  <p><strong>ModelRestController</strong></p>
  
  <pre><code>package com.rest;
  
  import com.dto.ModelDto;
  import com.general.Model;
  import com.service.ModelService;
  import org.springframework.beans.factory.annotation.Autowired;
  import org.springframework.http.HttpStatus;
  import org.springframework.web.bind.annotation.*;
  
  import org.apache.logging.log4j.LogManager;
  import org.apache.logging.log4j.Logger;
  
  import java.util.List;
  /**
   * Created by kohtpojiep on 23.01.16.
   */
  @RestController
  public class ModelRestController
  {
      private static final Logger LOGGER = LogManager.getLogger();
  
      @Autowired
      private ModelService modelService;
  
      @RequestMapping(value="/models", method = RequestMethod.GET)
      public @ResponseBody List&lt;Model&gt; getAllModels()
      {
          LOGGER.debug("Getting all models");
          return modelService.getAllModels();
      }
  
      @RequestMapping(value="/model", method = RequestMethod.POST)
      @ResponseStatus(value = HttpStatus.CREATED)
      public @ResponseBody Integer addModel(@RequestBody Model model)
      {
          LOGGER.debug("Adding model modelName = {}", model.getModelName());
          return modelService.addModel(model);
      }
  
      @RequestMapping (value="/model/{modelId}/{modelName}", method=RequestMethod.PUT)
      @ResponseStatus(value = HttpStatus.ACCEPTED)
      public @ResponseBody void updateModel(@PathVariable(value="modelId") Integer modelId,
                                            @PathVariable(value="modelName") String modelName)
      {
          LOGGER.debug("Updating model modelId = {}", modelId);
          modelService.updateModel(new Model(modelId,modelName));
      }
  
      @RequestMapping (value="/model/{modelName}", method = RequestMethod.DELETE)
      @ResponseStatus(value = HttpStatus.NO_CONTENT)
      public @ResponseBody void deleteModelByName(@PathVariable(value = "modelName") String modelName)
      {
          LOGGER.debug("Deleting model modelName= {}",modelName);
          modelService.deleteModelByName(modelName);
      }
  
      @RequestMapping (value="/modelsdto", method = RequestMethod.GET)
      @ResponseStatus(value = HttpStatus.OK)
      public @ResponseBody
      ModelDto getModelsDto()
      {
          LOGGER.debug("Getting models Dto");
          return modelService.getModelDto();
      }
  
  }
  </code></pre>
  
  <p><strong>AutomobileRestController</strong></p>
  
  <pre><code>package com.rest;
  
  import com.dto.AutomobileDto;
  import com.general.Automobile;
  import com.service.AutomobileService;
  import org.joda.time.LocalDate;
  import org.joda.time.format.DateTimeFormat;
  import org.joda.time.format.DateTimeFormatter;
  import org.springframework.beans.factory.annotation.Autowired;
  import org.springframework.http.HttpStatus;
  import org.springframework.web.bind.annotation.*;
  
  import org.apache.logging.log4j.LogManager;
  import org.apache.logging.log4j.Logger;
  
  import java.util.List;
  /**
   * Created by kohtpojiep on 02.02.16.
   */
  @RestController
  public class AutomobileRestController
  {
      private static final Logger LOGGER = LogManager.getLogger();
  
      @Autowired
      AutomobileService automobileService;
  
      private static LocalDate convertToLocalDate(String date)
      {
          DateTimeFormatter formattedDate = DateTimeFormat.forPattern("dd/MM/yyyy");
          return formattedDate.parseLocalDate(date);
      }
  
      @RequestMapping(value = "/automobiles", method = RequestMethod.GET)
      @ResponseStatus(value = HttpStatus.ACCEPTED)
      public @ResponseBody List&lt;Automobile&gt; getAllAutomobiles()
      {
          LOGGER.debug("Getting all automobiles");
          return automobileService.getAllAutomobiles();
      }
  
      @RequestMapping(value = "/automobile", method = RequestMethod.POST)
      @ResponseStatus(value = HttpStatus.CREATED)
      public @ResponseBody Integer addAutomobile (@RequestBody Automobile automobile)
      {
          LOGGER.debug("Adding automobile modelName = {}",automobile.getModelName());
          return automobileService.addAutomobile(automobile);
      }
  
      @RequestMapping(value = "/automobile/update", method = RequestMethod.PUT)
      @ResponseStatus(value = HttpStatus.ACCEPTED)
      public @ResponseBody void updateAutomobile (@RequestBody Automobile automobile)
      {
          LOGGER.debug("Updating automobile automobileId = {}", automobile.getAutomobileId());
          automobileService.updateAutomobile(automobile);
      }
  
      @RequestMapping(value = "/automobile/{automobileId}", method = RequestMethod.DELETE)
      @ResponseStatus(value = HttpStatus.NO_CONTENT)
      public @ResponseBody void depeteAutomobile (@PathVariable (value="automobileId")
                                                  Integer automobileId)
      {
          LOGGER.debug("Deleting automobile automobileId = {}",automobileId);
          automobileService.deleteAutomobileById(automobileId);
      }
  
      @RequestMapping(value = "/automobiles/date-sort", method = RequestMethod.GET)
      @ResponseStatus(value = HttpStatus.ACCEPTED)
      public @ResponseBody List&lt;Automobile&gt; getAutomobilesSortedByDate (@RequestParam(value="firstDate")
      String firstDate, @RequestParam (value="lastDate") String lastDate)
      {
          LOGGER.debug("Getting automobiles sorted by date:\n");
          return automobileService.getAutomobilesSortedByDate(
                  convertToLocalDate(firstDate),convertToLocalDate(lastDate));
      }
  
      @RequestMapping(value = "/automobilesdto", method = RequestMethod.GET)
      @ResponseStatus(value = HttpStatus.OK)
      public @ResponseBody
      AutomobileDto getAutomobileDto()
      {
          LOGGER.debug("Getting automobile DTO");
          return automobileService.getAutomobileDto();
      }
  }
  </code></pre>
  
  <p><strong>pom.xml</strong></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;parent&gt;
          &lt;artifactId&gt;usermanagement&lt;/artifactId&gt;
          &lt;groupId&gt;com.epam.brest.course2015&lt;/groupId&gt;
          &lt;version&gt;1.0.0-SNAPSHOT&lt;/version&gt;
      &lt;/parent&gt;
      &lt;modelVersion&gt;4.0.0&lt;/modelVersion&gt;
  
      &lt;artifactId&gt;app-rest&lt;/artifactId&gt;
      &lt;name&gt;${project.artifactId}&lt;/name&gt;
      &lt;packaging&gt;war&lt;/packaging&gt;
  
      &lt;dependencies&gt;
          &lt;dependency&gt;
              &lt;groupId&gt;com.epam.brest.course2015&lt;/groupId&gt;
              &lt;artifactId&gt;app-service&lt;/artifactId&gt;
          &lt;/dependency&gt;
          &lt;dependency&gt;
              &lt;groupId&gt;org.springframework&lt;/groupId&gt;
              &lt;artifactId&gt;spring-jdbc&lt;/artifactId&gt;
          &lt;/dependency&gt;
          &lt;dependency&gt;
              &lt;groupId&gt;org.springframework&lt;/groupId&gt;
              &lt;artifactId&gt;spring-webmvc&lt;/artifactId&gt;
          &lt;/dependency&gt;
          &lt;dependency&gt;
              &lt;groupId&gt;org.springframework&lt;/groupId&gt;
              &lt;artifactId&gt;spring-test&lt;/artifactId&gt;
          &lt;/dependency&gt;
          &lt;dependency&gt;
              &lt;groupId&gt;com.fasterxml.jackson.core&lt;/groupId&gt;
              &lt;artifactId&gt;jackson-databind&lt;/artifactId&gt;
          &lt;/dependency&gt;
          &lt;dependency&gt;
              &lt;groupId&gt;org.easymock&lt;/groupId&gt;
              &lt;artifactId&gt;easymock&lt;/artifactId&gt;
          &lt;/dependency&gt;
          &lt;dependency&gt;
              &lt;groupId&gt;junit&lt;/groupId&gt;
              &lt;artifactId&gt;junit&lt;/artifactId&gt;
          &lt;/dependency&gt;
          &lt;dependency&gt;
              &lt;groupId&gt;javax.servlet&lt;/groupId&gt;
              &lt;artifactId&gt;javax.servlet-api&lt;/artifactId&gt;
          &lt;/dependency&gt;
      &lt;/dependencies&gt;
  
      &lt;build&gt;
          &lt;plugins&gt;
              &lt;plugin&gt;
                  &lt;groupId&gt;org.mortbay.jetty&lt;/groupId&gt;
                  &lt;artifactId&gt;jetty-maven-plugin&lt;/artifactId&gt;
                  &lt;version&gt;8.1.16.v20140903&lt;/version&gt;
                  &lt;configuration&gt;
                      &lt;stopPort&gt;9091&lt;/stopPort&gt;
                      &lt;stopKey&gt;STOP&lt;/stopKey&gt;
                      &lt;webAppConfig&gt;
                          &lt;contextPath&gt;/rest&lt;/contextPath&gt;
                          &lt;allowDuplicateFragmentNames&gt;true&lt;/allowDuplicateFragmentNames&gt;
                      &lt;/webAppConfig&gt;
                      &lt;scanIntervalSeconds&gt;10&lt;/scanIntervalSeconds&gt;
                      &lt;connectors&gt;
                          &lt;connector implementation="org.eclipse.jetty.server.nio.SelectChannelConnector"&gt;
                              &lt;port&gt;8081&lt;/port&gt;
                          &lt;/connector&gt;
                      &lt;/connectors&gt;
                  &lt;/configuration&gt;
              &lt;/plugin&gt;
          &lt;/plugins&gt;
      &lt;/build&gt;
  
  
  &lt;/project&gt;
  </code></pre>
  
  <p>I saw solutions for similar situations: people offer to change versions of used frameworks and up the search level of component scan, but it doesn't work for me.</p>