java.lang.RuntimeException: json can't serialize type : class mypackage.MyClass$UserStatus

Spring JIRA | Poorna Subhash | 2 years ago
tip
Your exception is missing from the Samebug knowledge base.
Here are the best solutions we found on the Internet.
Click on the to mark the helpful solution and get rewards for you help.
  1. 0

    When enum value is used as part of {{Criteria}} object, when {{Query}} is throwing exception, serialization is failing. Following is stacktrace: {noformat} java.lang.RuntimeException: json can't serialize type : class mypackage.MyClass$UserStatus at com.mongodb.util.ClassMapBasedObjectSerializer.serialize(ClassMapBasedObjectSerializer.java:77) at com.mongodb.util.JSONSerializers$MapSerializer.serialize(JSONSerializers.java:317) at com.mongodb.util.ClassMapBasedObjectSerializer.serialize(ClassMapBasedObjectSerializer.java:79) at com.mongodb.util.JSONSerializers$MapSerializer.serialize(JSONSerializers.java:317) at com.mongodb.util.ClassMapBasedObjectSerializer.serialize(ClassMapBasedObjectSerializer.java:79) at com.mongodb.util.JSON.serialize(JSON.java:55) at com.mongodb.util.JSON.serialize(JSON.java:40) at com.mongodb.BasicDBObject.toString(BasicDBObject.java:83) at java.lang.String.valueOf(String.java:2854) at java.lang.StringBuilder.append(StringBuilder.java:128) at org.springframework.data.mongodb.core.query.Query.addCriteria(Query.java:88) {noformat} Also on side note (may qualify for another bug which caused above exception to appear) : MongoDB allows same multiple criteria on same key, For e.g., db.business.find({status:'Active', status:{$ne:'InActive'}},{status:1}) is working fine from mongodb console. If I try same thing using Criteria it causes exception. I can work around the problem, but in certain cases I would like to allow this where criteria is prepared dynamically.

    Spring JIRA | 2 years ago | Poorna Subhash
    java.lang.RuntimeException: json can't serialize type : class mypackage.MyClass$UserStatus
  2. 0

    When enum value is used as part of {{Criteria}} object, when {{Query}} is throwing exception, serialization is failing. Following is stacktrace: {noformat} java.lang.RuntimeException: json can't serialize type : class mypackage.MyClass$UserStatus at com.mongodb.util.ClassMapBasedObjectSerializer.serialize(ClassMapBasedObjectSerializer.java:77) at com.mongodb.util.JSONSerializers$MapSerializer.serialize(JSONSerializers.java:317) at com.mongodb.util.ClassMapBasedObjectSerializer.serialize(ClassMapBasedObjectSerializer.java:79) at com.mongodb.util.JSONSerializers$MapSerializer.serialize(JSONSerializers.java:317) at com.mongodb.util.ClassMapBasedObjectSerializer.serialize(ClassMapBasedObjectSerializer.java:79) at com.mongodb.util.JSON.serialize(JSON.java:55) at com.mongodb.util.JSON.serialize(JSON.java:40) at com.mongodb.BasicDBObject.toString(BasicDBObject.java:83) at java.lang.String.valueOf(String.java:2854) at java.lang.StringBuilder.append(StringBuilder.java:128) at org.springframework.data.mongodb.core.query.Query.addCriteria(Query.java:88) {noformat} Also on side note (may qualify for another bug which caused above exception to appear) : MongoDB allows same multiple criteria on same key, For e.g., db.business.find({status:'Active', status:{$ne:'InActive'}},{status:1}) is working fine from mongodb console. If I try same thing using Criteria it causes exception. I can work around the problem, but in certain cases I would like to allow this where criteria is prepared dynamically.

    Spring JIRA | 2 years ago | Poorna Subhash
    java.lang.RuntimeException: json can't serialize type : class mypackage.MyClass$UserStatus
  3. 0

    com.mongodb.util.JSON.serialize does not support UUID [moved]

    GitHub | 4 years ago | jyemin
    java.lang.RuntimeException: json can't serialize type : class java.util.UUID
  4. Speed up your debug routine!

    Automated exception search integrated into your IDE

  5. 0

    Converter not working when having multiple criterias in query - Tech Forum Network

    techforumnetwork.com | 1 year ago
    java.lang.RuntimeException: json can't serialize type : class kam.albert.domain.IdKey
  6. 0

    Trouble using Jackson 2 with Spring 3.2 - Spring Forum

    spring.io | 1 year ago
    java.lang.RuntimeException: json can't serialize type : class origami.qengine.Channels$Channel

    3 unregistered visitors
    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.RuntimeException

      json can't serialize type : class mypackage.MyClass$UserStatus

      at com.mongodb.util.ClassMapBasedObjectSerializer.serialize()
    2. MongoDB Java Driver
      BasicDBObject.toString
      1. com.mongodb.util.ClassMapBasedObjectSerializer.serialize(ClassMapBasedObjectSerializer.java:77)
      2. com.mongodb.util.JSONSerializers$MapSerializer.serialize(JSONSerializers.java:317)
      3. com.mongodb.util.ClassMapBasedObjectSerializer.serialize(ClassMapBasedObjectSerializer.java:79)
      4. com.mongodb.util.JSONSerializers$MapSerializer.serialize(JSONSerializers.java:317)
      5. com.mongodb.util.ClassMapBasedObjectSerializer.serialize(ClassMapBasedObjectSerializer.java:79)
      6. com.mongodb.util.JSON.serialize(JSON.java:55)
      7. com.mongodb.util.JSON.serialize(JSON.java:40)
      8. com.mongodb.BasicDBObject.toString(BasicDBObject.java:83)
      8 frames
    3. Java RT
      StringBuilder.append
      1. java.lang.String.valueOf(String.java:2854)
      2. java.lang.StringBuilder.append(StringBuilder.java:128)
      2 frames
    4. Spring Data MongoDB - Core
      Query.addCriteria
      1. org.springframework.data.mongodb.core.query.Query.addCriteria(Query.java:88)
      1 frame