Called: java.lang.NoClassDefFoundError: com / quickxml / jackson / databind / JsonMappingException $ Reference

I am completely new to Java. I am trying to display JSON data because I decided to go to the Jackson library. But I get an error message.

I use

jackson-annotations-2.3.0.jar jackson-core-2.4.2.jar jackson-databind-2.4.2.jar 

This is my object, and I have one dependency "tnStudentLocLog"

 public class Student implements java.io.Serializable, WorkItem { private int studentId; private Date date; private Date startTime; private Date endtime; private int room; private Set tnStudentLocLog; public Student() { } public Student(int studentId,Date date, int room, Date startTime, Date endtime) { this.studentId = studentId; this.date = date; this.room = room; this.startTime = startTime; this.endtime = endtime; } } 

UserController Class:

  @Controller @RequestMapping(value="/students") public class StudentController { private static Logger logger = Logger.getLogger( StudentController.class); private StudentManagerDelegate studentDelegate; public StudentController() throws Exception { studentDelegate= new StudentManagerDelegate(ServiceType.LOCAL); } /********* GET ALL STUDENTS ************/ @RequestMapping(method=RequestMethod.GET) @ResponseStatus(HttpStatus.OK) public @ResponseBody SuccessResponse<List<Student>> getAllStudents() throws Exception { Map<String,List<Student>> studentsMap = new HashMap<String,List<Student>>(); SuccessResponse<List<Student>> resp = new SuccessResponse<List<Student>>(); resp.list = studentDelegate.load(); return resp; } 

Here I get the correct result. But "studentId": 2 loops as shown below

  {"max":"30","list":[{"studentId":2,"date":1339327730000,"startTime":1339327806000,"endtime":1339329470000,"room":0,"tnStudentLocLog": [{"id":"studentId":2,"inTime":1339327872000},"sequenceId":2,"outTime":1339327967000,"Student":{"studentId":2,"date":1339327730000,"startTime":1339327806000,"endtime":1339329470000,"tnStudentLocLog":[{"id":{"studentId":2,"room":10,"inTime":1339327872000},"sequenceId":2,"outTime":1339327967000,"Student":{"studentId":2,"date":1339327730000,"startTime":1339327806000,"endtime":1339329470000,"tnStudentLocLog":[{"id":....... 

But, in the URL, when I enter "/ students / 4". It is displayed correctly. I donโ€™t know what exactly is happening. I saw a lot of posts, they change Jackson kernel versions, annotations. But this does not work in my case.

Thanks in advance for your help.

+5
source share
3 answers

Check if you have a circular dependency, if you have a circular dependency, you can ignore it with @JsonIgnore Check here the cyclic dependency

+3
source

Welcome to java. One of the first things you will need to learn when using Java is to configure and use CLASSPATH. The โ€œClass Not Foundโ€ error means that one or more of your jar files are not in the class path. Java does not mean anywhere (not even the same subdirectory where your classes are) for .jar files. You have to tell where to look. How to configure CLASSPATH? It depends on your platform (Windows, Linux, IIS, Apache, Tomcat, Bluejay, Eclipse, etc.). Find out what is good; you will prevent a big headache.

+2
source

You are missing a jar file that will contain the required class com.fasterxml.jackson.databind.JsonMappingException

You can download it here and include it in your class path.

+2
source

Source: https://habr.com/ru/post/1208576/


All Articles