0

My spring boot rest application has a controller with the below method. It uses hibernate internally to get data from Oracle DB. My issue is that, when I invoke this service, it returns a HTTP ERROR 500. But there aren't any errors logged anywhere and the debug log in the below code prints the entire Job object without any issues. I debugged and saw that the job object is returning as well.

I doubt some data is causing issue when converting the Job object to json, but how do I find which field is causing the issue ?

Is there a way to log issues occuring during the json conversion ?

@GetMapping(params = {"jobId"})
  @ResponseBody
  public Job findById(long jobId) {
    Job job = jobHistoryService.findById(jobId);
    log.debug(job.toString());
    return job;
  }
jijo
  • 765
  • 3
  • 18
  • 35

1 Answers1

1

I followed the advice in comment and set log level in applicaion.yml to info and it printed out the error. The error printed out was this.

com.fasterxml.jackson.databind.JsonMappingException: No serializer found for class org.hibernate.proxy.pojo.bytebuddy.ByteBuddyInterceptor

Searched stack overflow and found this solution of adding the below to entites and it worked like a charm.Thanks guys !

@JsonIgnoreProperties({"hibernateLazyInitializer", "handler"}) 

stackoverflow link

jijo
  • 765
  • 3
  • 18
  • 35