title: java.lang.ClassNotFoundException: com.fasterxml.jackson.core.JsonProcessingException
body: <p>I'm using <code>templateRest</code> to post <code>User</code> object to <code>Rest Server</code> but I encoutered the following error:</p>
  
  <blockquote>
    <p>Exception in thread "main" java.lang.NoClassDefFoundError:
    com/fasterxml/jackson/core/JsonProcessingException    at
    edu.java.spring.service.client.RestClientTest.main(RestClientTest.java:33)
    Caused by: java.lang.ClassNotFoundException:
    com.fasterxml.jackson.core.JsonProcessingException    at
    java.net.URLClassLoader.findClass(Unknown Source)     at
    java.lang.ClassLoader.loadClass(Unknown Source)   at
    sun.misc.Launcher$AppClassLoader.loadClass(Unknown Source)    at
    java.lang.ClassLoader.loadClass(Unknown Source)   ... 1 more</p>
  </blockquote>
  
  <p>Here is the file <code>RestClientTest.java</code></p>
  
  <pre><code>public class RestClientTest {
  
      public static void main(String[] args) throws IOException{
          RestTemplate rt = new RestTemplate();
  //      System.out.println("Rest Response" + loadUser("quypham"));
  //      URL url = new URL("http://localhost:8080/rest/user/create");
          rt.getMessageConverters().add(new MappingJackson2HttpMessageConverter());
          rt.getMessageConverters().add(new StringHttpMessageConverter());
  //      Map&lt;String,String&gt; vars = new HashMap&lt;String,String&gt;();
  
          User user = new User();
          user.setUserName("datpham");
          user.setPassWord("12345");
          Calendar calendar = Calendar.getInstance();
          calendar.set(Calendar.YEAR,1960);
          user.setBirthDay(calendar.getTime());
          user.setAge(12);
          String uri = new String("http://localhost:8080/rest/user/create");
          User returns = rt.postForObject(uri, user,User.class);
  
  //      createUser(user);
          System.out.println("Rest Response" + loadUser("datpham"));
      }
  </code></pre>
  
  <p>Here is the file <code>UserRestServiceController.java</code></p>
  
  <pre><code>@Controller
  public class UserRestServiceController {
      @Autowired
      public  UserDao userDao;
      @RequestMapping(value = "/rest/user/create",method = RequestMethod.POST)
      @ResponseStatus(HttpStatus.CREATED)
      public void addUser(@RequestBody User user){
          userDao.save(user);
      }
  </code></pre>
  
  <p>Here is the file pom.xml</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/maven-v4_0_0.xsd"&gt;
    &lt;modelVersion&gt;4.0.0&lt;/modelVersion&gt;
    &lt;groupId&gt;edu.java.spring.service&lt;/groupId&gt;
    &lt;artifactId&gt;springDAT-service&lt;/artifactId&gt;
    &lt;packaging&gt;war&lt;/packaging&gt;
    &lt;version&gt;1.0-SNAPSHOT&lt;/version&gt;
    &lt;name&gt;springDAT-service Maven Webapp&lt;/name&gt;
    &lt;url&gt;http://maven.apache.org&lt;/url&gt;
    &lt;dependencies&gt;
      &lt;dependency&gt;
        &lt;groupId&gt;junit&lt;/groupId&gt;
        &lt;artifactId&gt;junit&lt;/artifactId&gt;
        &lt;version&gt;3.8.1&lt;/version&gt;
        &lt;scope&gt;test&lt;/scope&gt;
      &lt;/dependency&gt;
      &lt;dependency&gt;
          &lt;groupId&gt;org.springframework&lt;/groupId&gt;
          &lt;artifactId&gt;spring-core&lt;/artifactId&gt;
          &lt;version&gt;4.0.3.RELEASE&lt;/version&gt;
      &lt;/dependency&gt;
  
      &lt;dependency&gt;
          &lt;groupId&gt;org.springframework&lt;/groupId&gt;
          &lt;artifactId&gt;spring-context&lt;/artifactId&gt;
          &lt;version&gt;4.0.3.RELEASE&lt;/version&gt;
      &lt;/dependency&gt;
      &lt;dependency&gt;
          &lt;groupId&gt;org.springframework&lt;/groupId&gt;
          &lt;artifactId&gt;spring-context-support&lt;/artifactId&gt;
          &lt;version&gt;4.0.3.RELEASE&lt;/version&gt;
      &lt;/dependency&gt;
      &lt;dependency&gt;
          &lt;groupId&gt;org.springframework&lt;/groupId&gt;
          &lt;artifactId&gt;spring-web&lt;/artifactId&gt;
          &lt;version&gt;4.0.3.RELEASE&lt;/version&gt;
      &lt;/dependency&gt;
      &lt;dependency&gt;
          &lt;groupId&gt;org.springframework&lt;/groupId&gt;
          &lt;artifactId&gt;spring-webmvc&lt;/artifactId&gt;
          &lt;version&gt;4.0.3.RELEASE&lt;/version&gt;
      &lt;/dependency&gt;
  
      &lt;dependency&gt;
          &lt;groupId&gt;org.springframework&lt;/groupId&gt;
          &lt;artifactId&gt;spring-orm&lt;/artifactId&gt;
          &lt;version&gt;4.0.3.RELEASE&lt;/version&gt;
      &lt;/dependency&gt;
  
      &lt;dependency&gt;
          &lt;groupId&gt;org.hibernate&lt;/groupId&gt;
          &lt;artifactId&gt;hibernate-core&lt;/artifactId&gt;
          &lt;version&gt;5.1.0.Final&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;dependency&gt;
          &lt;groupId&gt;org.apache.derby&lt;/groupId&gt;
          &lt;artifactId&gt;derby&lt;/artifactId&gt;
          &lt;version&gt;10.12.1.1&lt;/version&gt;
      &lt;/dependency&gt;
  
      &lt;dependency&gt;
      &lt;groupId&gt;org.codehaus.jackson&lt;/groupId&gt;
      &lt;artifactId&gt;jackson-mapper-asl&lt;/artifactId&gt;
      &lt;version&gt;1.9.13&lt;/version&gt;
  &lt;/dependency&gt;
  
      &lt;dependency&gt;
      &lt;groupId&gt;jstl&lt;/groupId&gt;
      &lt;artifactId&gt;jstl&lt;/artifactId&gt;
      &lt;version&gt;1.2&lt;/version&gt;
  &lt;/dependency&gt;
  
  
    &lt;/dependencies&gt;
    &lt;build&gt;
      &lt;finalName&gt;springMOTHER-service&lt;/finalName&gt;
      &lt;plugins&gt;
              &lt;plugin&gt;
                  &lt;groupId&gt;org.apache.maven.plugins&lt;/groupId&gt;
                  &lt;artifactId&gt;maven-surefire-plugin&lt;/artifactId&gt;
                  &lt;version&gt;2.12.4&lt;/version&gt;
                  &lt;configuration&gt;
                      &lt;skipTests&gt;true&lt;/skipTests&gt;
                      &lt;argLine&gt;-Xmx2524m&lt;/argLine&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;version&gt;3.1&lt;/version&gt;
                  &lt;configuration&gt;
                      &lt;source&gt;1.8&lt;/source&gt;
                      &lt;target&gt;1.8&lt;/target&gt;
                      &lt;encoding&gt;UTF-8&lt;/encoding&gt;
                      &lt;fork&gt;true&lt;/fork&gt;
                      &lt;compilerArgs&gt;
                          &lt;arg&gt;-XDignore.symbol.file&lt;/arg&gt;
                      &lt;/compilerArgs&gt;
                  &lt;/configuration&gt;
              &lt;/plugin&gt;
  
              &lt;plugin&gt;
                  &lt;groupId&gt;org.eclipse.jetty&lt;/groupId&gt;
                  &lt;artifactId&gt;jetty-maven-plugin&lt;/artifactId&gt;
                  &lt;version&gt;9.3.0.M1&lt;/version&gt;
                  &lt;configuration&gt;
                      &lt;jvmArgs&gt;-Xmx1048m -Xms536m
                          -XX:PermSize=128m -XX:MaxPermSize=512m&lt;/jvmArgs&gt;
                      &lt;reload&gt;manual&lt;/reload&gt;
                      &lt;systemProperties&gt;
                          &lt;systemProperty&gt;
                              &lt;name&gt;lib&lt;/name&gt;
                              &lt;value&gt;${basedir}/target/spring-mvc/WEB-INF/lib&lt;/value&gt;
                          &lt;/systemProperty&gt;
                      &lt;/systemProperties&gt;
                      &lt;scanIntervalSeconds&gt;3&lt;/scanIntervalSeconds&gt;
                      &lt;connectors&gt;
                          &lt;connector implementation="org.mortbay.jetty.nio.SelectChannelConnector"&gt;
                              &lt;port&gt;8080&lt;/port&gt;
                              &lt;maxIdleTime&gt;60000&lt;/maxIdleTime&gt;
                          &lt;/connector&gt;
                      &lt;/connectors&gt;
                      &lt;contextPath&gt;/&lt;/contextPath&gt;
                      &lt;webAppSourceDirectory&gt;${basedir}/src/main/webapp&lt;/webAppSourceDirectory&gt;
                      &lt;webXml&gt;${basedir}/src/main/webapp/WEB-INF/web.xml&lt;/webXml&gt;
                      &lt;classesDirectory&gt;${basedir}/target/classes&lt;/classesDirectory&gt;
                  &lt;/configuration&gt;
              &lt;/plugin&gt;
  
          &lt;/plugins&gt;
  
    &lt;/build&gt;
  &lt;/project&gt;
  </code></pre>
  
  <p>I have browsed information on google, afterwards I have tried to add jackson 2.4 in pom.xml but didn't seem to work:</p>
  
  <pre><code>&lt;dependency&gt;
      &lt;groupId&gt;com.fasterxml.jackson.core&lt;/groupId&gt;
      &lt;artifactId&gt;jackson-databind&lt;/artifactId&gt;
      &lt;version&gt;2.4.0-rc3&lt;/version&gt;
  &lt;/dependency&gt;
  </code></pre>