1. ホーム
  2. json

ajax return json format Report 500 Internal Server Error

2022-02-22 17:26:15

今日のAjaxは、json形式に戻るには、バックグラウンドは、500 Internal Server Errorを報告したときにAjaxにのみデータを照会することができます、Firefox固有のデバッグを使用していくつかのエラーメッセージは、次のエラーメッセージの一部である。

nested exception is com.fasterxml.jackson.databind.JsonMappingException: No serializer found for class org.hibernate.proxy.pojo.javassist. JavassistLazyInitializer and no properties discovered to create BeanSerializer (to avoid exception, disable SerializationConfig. SerializationFeature.FAIL_ON_EMPTY_BEANS) ) (through reference chain: com.tgb.entity.CardInfo["cardPersonalInfo"]->com.tgb .entity.CardPersonalInfo_$$_javassist_15["handler"])

The reason is that my entity CardInfo cascades to the entity CardPersonalInfo, and the entity CardPersonalInfo cascades to CardInfo, and when I return the CardInfo JSON format in the backend, it reports a serialization error because the CardPersonalInfo entity object associated with CardInfo When it is empty, FAIL_ON_EMPTY_BEANS error is reported
My solution is to add the following annotation to the CardPersonalInfo entity class.

@JsonIgnoreProperties(value={"hibernateLazyInitializer","handler","operations","roles","menus"}) quot;menus"})


This generates JSON without redundant fields in the generated JSON.






The reason is that my entity CardInfo cascades to the entity CardPersonalInfo, and the entity CardPersonalInfo cascades to CardInfo, and when I return the CardInfo JSON format in the backend, it reports a serialization error because the CardPersonalInfo entity object associated with CardInfo When it is empty, FAIL_ON_EMPTY_BEANS error is reported
My solution is to add the following annotation to the CardPersonalInfo entity class.

@JsonIgnoreProperties(value={"hibernateLazyInitializer","handler","operations","roles","menus"}) quot;menus"})


This generates JSON without redundant fields in the generated JSON.