I create 2 small micro-services, one is a product service and other one is a catalog service. only the product service deals with the database. Product service is working perfectly with the database. but I cannot access the product Object via the catalog service.
I get the following error:
Cannot deserialize instance of
Entity.Course
out of START_ARRAY token at [Source:(PushbackInputStream); line: 1, column: 1]
How can I fix this?
@GetMapping("/catelog")
public Course getCourseObject() {
String CourseUrl="http://localhost:9090/courses";
Course course;
RestTemplate rest=new RestTemplate();
course =rest.getForObject(CourseUrl, Course.class);
return course;
}
I guess your call returns an array...so
return rest.getForObject(CourseUrl, Course[].class);
of course also edit the return type from Course to Course[]