java.lang.IllegalArgumentException: No serializer found for class org.springframework.data.mongodb.crossstore.MongoChangeSetPersister and no properties discovered to create BeanSerializer (to avoid exception, disable SerializationConfig.Feature.FAIL_ON_EMPTY_BEANS) ) (through reference chain: com.company.User["itdChangeSetPersister"])

Spring JIRA | Ludovic Praud | 3 years ago
  1. 0

    We got this stacktrace when trying to serialize our User @Entity to Json using Jackson through playframework. {code} java.lang.RuntimeException: java.lang.IllegalArgumentException: No serializer found for class org.springframework.data.mongodb.crossstore.MongoChangeSetPersister and no properties discovered to create BeanSerializer (to avoid exception, disable SerializationConfig.Feature.FAIL_ON_EMPTY_BEANS) ) (through reference chain: com.company.User["itdChangeSetPersister"]) at play.libs.Json.toJson(Json.java:21) {code} I have listed getDeclaredFields and getDeclaredMethods of our User entity. It appears that there are some fields which are added by AOP. {code} User.class.getDeclaredFields[] public org.springframework.data.crossstore.ChangeSet com.company.User.changeSet public org.springframework.data.crossstore.ChangeSetPersister com.company.User.itdChangeSetPersister public org.springframework.data.crossstore.ChangeSetBackedTransactionSynchronization com.company.User.itdTransactionSynchronization private static final org.aspectj.lang.JoinPoint$StaticPart com.company.User.ajc$tjp_0 private static final org.aspectj.lang.JoinPoint$StaticPart com.company.User.ajc$tjp_1 User.class.getDeclaredMethods[] public org.springframework.data.crossstore.ChangeSet com.company.User.ajc$interFieldGet$org_springframework_data_mongodb_crossstore_MongoDocumentBacking$org_springframework_data_mongodb_crossstore_DocumentBacked$changeSet() public void com.company.User.ajc$interFieldSet$org_springframework_data_mongodb_crossstore_MongoDocumentBacking$org_springframework_data_mongodb_crossstore_DocumentBacked$changeSet(org.springframework.data.crossstore.ChangeSet) public org.springframework.data.crossstore.ChangeSetPersister com.company.User.ajc$interFieldGet$org_springframework_data_mongodb_crossstore_MongoDocumentBacking$org_springframework_data_mongodb_crossstore_DocumentBacked$itdChangeSetPersister() public void com.company.User.ajc$interFieldSet$org_springframework_data_mongodb_crossstore_MongoDocumentBacking$org_springframework_data_mongodb_crossstore_DocumentBacked$itdChangeSetPersister(org.springframework.data.crossstore.ChangeSetPersister) public org.springframework.data.crossstore.ChangeSetBackedTransactionSynchronization com.company.User.ajc$interFieldGet$org_springframework_data_mongodb_crossstore_MongoDocumentBacking$org_springframework_data_mongodb_crossstore_DocumentBacked$itdTransactionSynchronization() public void com.company.User.ajc$interFieldSet$org_springframework_data_mongodb_crossstore_MongoDocumentBacking$org_springframework_data_mongodb_crossstore_DocumentBacked$itdTransactionSynchronization(org.springframework.data.crossstore.ChangeSetBackedTransactionSynchronization) public org.springframework.data.crossstore.ChangeSet com.company.User.getChangeSet() public java.lang.Object com.company.User.get_persistent_id() public void com.company.User.itdPostLoad() public void com.company.User.itdPostPersist() public void com.company.User.itdPostRemove() public void com.company.User.itdPostUpdate() public void com.company.User.itdPreUpdate() public void com.company.User.setChangeSet(org.springframework.data.crossstore.ChangeSet) private static void com.company.User.ajc$preClinit() {code} Field such as {{public org.springframework.data.crossstore.ChangeSetPersister}} should not be public but private and maybe transient by default, as we don't want them to be serialized by Json beans tools and we don't want to be aware of their existence. As workaround, we will try to ignore these fields in our Json config. somehow related to org.springframework.data.mongodb.crossstore.MongoDocumentBacking

    Spring JIRA | 3 years ago | Ludovic Praud
    java.lang.IllegalArgumentException: No serializer found for class org.springframework.data.mongodb.crossstore.MongoChangeSetPersister and no properties discovered to create BeanSerializer (to avoid exception, disable SerializationConfig.Feature.FAIL_ON_EMPTY_BEANS) ) (through reference chain: com.company.User["itdChangeSetPersister"])
  2. 0

    We got this stacktrace when trying to serialize our User @Entity to Json using Jackson through playframework. {code} java.lang.RuntimeException: java.lang.IllegalArgumentException: No serializer found for class org.springframework.data.mongodb.crossstore.MongoChangeSetPersister and no properties discovered to create BeanSerializer (to avoid exception, disable SerializationConfig.Feature.FAIL_ON_EMPTY_BEANS) ) (through reference chain: com.company.User["itdChangeSetPersister"]) at play.libs.Json.toJson(Json.java:21) {code} I have listed getDeclaredFields and getDeclaredMethods of our User entity. It appears that there are some fields which are added by AOP. {code} User.class.getDeclaredFields[] public org.springframework.data.crossstore.ChangeSet com.company.User.changeSet public org.springframework.data.crossstore.ChangeSetPersister com.company.User.itdChangeSetPersister public org.springframework.data.crossstore.ChangeSetBackedTransactionSynchronization com.company.User.itdTransactionSynchronization private static final org.aspectj.lang.JoinPoint$StaticPart com.company.User.ajc$tjp_0 private static final org.aspectj.lang.JoinPoint$StaticPart com.company.User.ajc$tjp_1 User.class.getDeclaredMethods[] public org.springframework.data.crossstore.ChangeSet com.company.User.ajc$interFieldGet$org_springframework_data_mongodb_crossstore_MongoDocumentBacking$org_springframework_data_mongodb_crossstore_DocumentBacked$changeSet() public void com.company.User.ajc$interFieldSet$org_springframework_data_mongodb_crossstore_MongoDocumentBacking$org_springframework_data_mongodb_crossstore_DocumentBacked$changeSet(org.springframework.data.crossstore.ChangeSet) public org.springframework.data.crossstore.ChangeSetPersister com.company.User.ajc$interFieldGet$org_springframework_data_mongodb_crossstore_MongoDocumentBacking$org_springframework_data_mongodb_crossstore_DocumentBacked$itdChangeSetPersister() public void com.company.User.ajc$interFieldSet$org_springframework_data_mongodb_crossstore_MongoDocumentBacking$org_springframework_data_mongodb_crossstore_DocumentBacked$itdChangeSetPersister(org.springframework.data.crossstore.ChangeSetPersister) public org.springframework.data.crossstore.ChangeSetBackedTransactionSynchronization com.company.User.ajc$interFieldGet$org_springframework_data_mongodb_crossstore_MongoDocumentBacking$org_springframework_data_mongodb_crossstore_DocumentBacked$itdTransactionSynchronization() public void com.company.User.ajc$interFieldSet$org_springframework_data_mongodb_crossstore_MongoDocumentBacking$org_springframework_data_mongodb_crossstore_DocumentBacked$itdTransactionSynchronization(org.springframework.data.crossstore.ChangeSetBackedTransactionSynchronization) public org.springframework.data.crossstore.ChangeSet com.company.User.getChangeSet() public java.lang.Object com.company.User.get_persistent_id() public void com.company.User.itdPostLoad() public void com.company.User.itdPostPersist() public void com.company.User.itdPostRemove() public void com.company.User.itdPostUpdate() public void com.company.User.itdPreUpdate() public void com.company.User.setChangeSet(org.springframework.data.crossstore.ChangeSet) private static void com.company.User.ajc$preClinit() {code} Field such as {{public org.springframework.data.crossstore.ChangeSetPersister}} should not be public but private and maybe transient by default, as we don't want them to be serialized by Json beans tools and we don't want to be aware of their existence. As workaround, we will try to ignore these fields in our Json config. somehow related to org.springframework.data.mongodb.crossstore.MongoDocumentBacking

    Spring JIRA | 3 years ago | Ludovic Praud
    java.lang.IllegalArgumentException: No serializer found for class org.springframework.data.mongodb.crossstore.MongoChangeSetPersister and no properties discovered to create BeanSerializer (to avoid exception, disable SerializationConfig.Feature.FAIL_ON_EMPTY_BEANS) ) (through reference chain: com.company.User["itdChangeSetPersister"])
  3. 0

    Bloch's Builder Pattern with Spring

    Stack Overflow | 3 years ago | Jamie White
    java.lang.IllegalArgumentException: No serializer found for class com.AllTweets$Builder and no properties discovered to create BeanSerializer (to avoid exception, disable SerializationConfig.Feature.FAIL_ON_EMPTY_BEANS) ) (through reference chain: com.AllTweets["builder"])
  4. Speed up your debug routine!

    Automated exception search integrated into your IDE

  5. 0

    Play async example resulting in BeanSerializer issues

    Google Groups | 10 months ago | Alex Mueller
    java.lang.IllegalArgumentException: No serializer found for class play.libs.F$Promise and no properties discovered to create BeanSerializer (to avoid exception, disable SerializationFeature.FAIL_ON_EMPTY_BEANS) )]] at play.api.http.HttpErrorHandlerExceptions$.throwableToUsefulException(HttpErrorHandler.scala:265) ~[play_2.11-2.4.6.jar:2.4.6] at play.api.http.DefaultHttpErrorHandler.onServerError(HttpErrorHandler.scala:191) ~[play_2.11-2.4.6.jar:2.4.6]
  6. 0

    Kryonet Serialization Error

    Stack Overflow | 2 years ago | Albion
    java.lang.IllegalArgumentException: Unable to create serializer "com.esotericsoftware.kryo.serializers.FieldSerializer" for class: com.esotericsoftware.kryonet.FrameworkMessage$RegisterTCP

    Not finding the right solution?
    Take a tour to get the most out of Samebug.

    Tired of useless tips?

    Automated exception search integrated into your IDE

    Root Cause Analysis

    1. java.lang.IllegalArgumentException

      No serializer found for class org.springframework.data.mongodb.crossstore.MongoChangeSetPersister and no properties discovered to create BeanSerializer (to avoid exception, disable SerializationConfig.Feature.FAIL_ON_EMPTY_BEANS) ) (through reference chain: com.company.User["itdChangeSetPersister"])

      at play.libs.Json.toJson()
    2. Play
      Json.toJson
      1. play.libs.Json.toJson(Json.java:21)
      1 frame