title: NoClassDefFoundError JsonAutoDetect while parsing JSON object
body: <p>I am developing a webapp using Amazon's cloud services and I need to make use of JSON objects. How my project is set up is, I have an HTML form where the user will fill in their information and submit. Once submitted the data will be placed into an online database and a confirmation email is sent to them. Before I can submit the data to the data base I need to place all of it into a JSON object. My servlet, done in Java, looks like this:</p>
  
  <pre><code>public class FormHandling extends HttpServlet {
      //doGet function
      public void doGet (HttpServletRequest request, HttpServletResponse response)
          throws ServletException, IOException {
          // In this part of the code I take in the user data and build an HTML
          // page and return it to the user
  
          // Create String Mapping for User Data object
          Map&lt;String,Object&gt; userData = new HashMap&lt;String,Object&gt;();
  
          // Map the names into one struct. In the code below we are creating 
          // values for the nameStruct from the information the user has
          // submitted on the form.
          Map&lt;String,String&gt; nameStruct = new HashMap&lt;String,String&gt;();
          nameStruct.put("fName", request.getParameter("fname"));
          nameStruct.put("lName", request.getParameter("lname"));
          nameStruct.put("mInit", request.getParameter("minit"));
  
          // Map the three email's together (providing there are 3).
          // This is the same logic as the names.
          Map&lt;String,String&gt; emailStruct = new HashMap&lt;String,String&gt;();
          emailStruct.put("email", request.getParameter("email1"));
          emailStruct.put("email", request.getParameter("email2"));
          emailStruct.put("email", request.getParameter("email3"));
  
          // Put Name Hash Value Pair inside User Data Object
          userData.put("name", nameStruct);
          userData.put("emails", emailStruct);
          userData.put("age", 22);
  
          // Create the Json data from the userData
          createJson(userData);
  
          // Close writer
          out.close();
      }
  
      public File createJson(Map&lt;String,Object&gt; userData) 
          throws JsonGenerationException, JsonMappingException, IOException {
          File user = new File("user.json");
  
          // Create mapper object
          ObjectMapper mapper = new ObjectMapper();
  
          // Add the userData information to the json file
          mapper.writeValue(user, userData);
          return user;
      }
  }
  </code></pre>
  
  <p>When I submit the form using this code I get the following error message:</p>
  
  <blockquote>
    <p>java.lang.NoClassDefFoundError: com/fasterxml/jackson/annotation/JsonAutoDetect
        com.fasterxml.jackson.databind.introspect.VisibilityChecker$Std.(VisibilityChecker.java:169)
        com.fasterxml.jackson.databind.ObjectMapper.(ObjectMapper.java:197)
        edu.tcnj.FormHandling.createJson(FormHandling.java:115)
        edu.tcnj.FormHandling.doGet(FormHandling.java:104)
        edu.tcnj.FormHandling.doPost(FormHandling.java:131)
        javax.servlet.http.HttpServlet.service(HttpServlet.java:641)
        javax.servlet.http.HttpServlet.service(HttpServlet.java:722)</p>
  </blockquote>
  
  <p>Now I know that error means that it isn't finding the Jackson databind library. I am developing in Eclipse and I know the build path messes up from time to time so I also placed the libraries in the WebContent\WEB-INF\lib folder. This has solved issues I've had before. However, this does not seem to solve my problem this time around. I have even opened the jar files to physically check that the library and class needed are there, and they are. I've tried searching all over and looking into different ways to include the library but nothing seems to work.</p>