NoClassDefFoundError JsonAutoDetect podczas analizowania obiektu JSON

Zajmuję się tworzeniem aplikacji internetowej wykorzystującej usługi w chmurze Amazon i muszę korzystać z obiektów JSON. W jaki sposób mój projekt jest skonfigurowany, mam formularz HTML, w którym użytkownik wypełnia swoje informacje i przesyła. Po przesłaniu dane zostaną umieszczone w internetowej bazie danych i zostanie do nich wysłana wiadomość e-mail z potwierdzeniem. Zanim będę mógł przesłać dane do bazy danych, muszę umieścić je wszystkie w obiekcie JSON. Mój serwlet, wykonany w Javie, wygląda tak:

<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<String,Object> userData = new HashMap<String,Object>();

        // 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<String,String> nameStruct = new HashMap<String,String>();
        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<String,String> emailStruct = new HashMap<String,String>();
        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<String,Object> 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>

Po przesłaniu formularza za pomocą tego kodu otrzymuję następujący komunikat o błędzie:

java.lang.NoClassDefFoundError: com / szybciejxml / 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)

Teraz wiem, że ten błąd oznacza, że ​​nie znajduje biblioteki bazy danych Jacksona. Zajmuję się tworzeniem Eclipse i wiem, że ścieżka kompilacji od czasu do czasu się wzmaga, więc umieściłem biblioteki w folderze WWW WebContent WEB-INF. To rozwiązało problemy, które miałem wcześniej. Wydaje się jednak, że tym razem nie rozwiąże to mojego problemu. Otworzyłem nawet pliki jar, aby fizycznie sprawdzić, czy potrzebna biblioteka i klasa są i są. Próbowałem przeszukać wszystko i spojrzeć na różne sposoby włączenia biblioteki, ale nic nie działa.

questionAnswers(5)

yourAnswerToTheQuestion