title: @ControllerAdvise is not catching UnrecognizedPropertyException exception - Springboot
body: <p>I have a problem where I am trying to catch an exception from Entity class and get it handled by @ControllerAdvise 's exception handler method</p>
  <p>below is the method under Entity class (I am trying map a Json String which has saved Blob in my db)</p>
  <pre><code>@Entity
  @Table(&quot;mytable&quot;)
  @Getters
  @Setters
  public class myData{
  private String id;
  
  @Lob
  private String dbData;
  
  @Transient
  private Data data;
  
  public Data getData() throws JsonProcessingException{
   if(data == null){
    ObjectMapper om = new ObjectMapper()
    data = mapper.readValue(dbData, Data.class);
   }
   return data;
  }
  }
  </code></pre>
  <p><strong>GlobalException Handler</strong></p>
  <pre><code>@ControllerAdvise
  public class MainExceptionHandler extends ResponseEntityExceptionHandler {
  
   // other methods
  
  @ExceptionHandler(Exception.class)
  public ResponseEntity&lt;Object&gt; handleException(Exception e){
  
  // log exception
  
  }
  
  @ExceptionHandler(JsonProcessingException.class)
  public ResponseEntity&lt;Object&gt; handleJsonException(JsonProcessingException e){
  
  // log exception
  
  }
  </code></pre>
  <p>}</p>
  <p><strong>Controller Class</strong></p>
  <pre><code>@Autowired
  DataService dataService;
  
  @PostMapping(&quot;/api/getData&quot;)
  public ResponseEntiry&lt;Data&gt; getData(@RequestBody Payload payload){
  
  Data data = dataService.fetchData(payload);
  ResponseEntity&lt;Data&gt; response= new ResponseEntity&lt;&gt;(data, HttpStatus.Ok);
  
  return response; // the exception getting raised when it sending this response
  
  }
  </code></pre>
  <p><strong>Service Class</strong></p>
  <pre><code>@Autowired
  DataRepository dataRepo;
  
  public Data fetchData(Payload payload){
  
  return dataRepo.findById(payload.getID());
  
  }
  </code></pre>
  <p>When the data is not properly mapped it's throwing an exception and I am getting 500 error in post man but not able to catch this exception and log it through @ControllerAdvise</p>
  <p><strong>Please help</strong></p>
  <p><strong>Update 1:</strong>
  tried to implement httpMessageNotReadble method but still no luck</p>