java.lang.RuntimeException

There are no available Samebug tips for this exception. Do you have an idea how to solve this issue? A short tip would help users who saw this issue last week.

  • {noformat} java.lang.RuntimeException: json can't serialize type : class com.viditure.entities.DocRecipient at com.mongodb.util.ClassMapBasedObjectSerializer.serialize(ClassMapBasedObjectSerializer.java:77) ~[mongo-java-driver-2.12.1.jar:na] at com.mongodb.util.JSONSerializers$MapSerializer.serialize(JSONSerializers.java:317) ~[mongo-java-driver-2.12.1.jar:na] at com.mongodb.util.ClassMapBasedObjectSerializer.serialize(ClassMapBasedObjectSerializer.java:79) ~[mongo-java-driver-2.12.1.jar:na] at com.mongodb.util.JSONSerializers$MapSerializer.serialize(JSONSerializers.java:317) ~[mongo-java-driver-2.12.1.jar:na] at com.mongodb.util.ClassMapBasedObjectSerializer.serialize(ClassMapBasedObjectSerializer.java:79) ~[mongo-java-driver-2.12.1.jar:na] at com.mongodb.util.JSON.serialize(JSON.java:55) ~[mongo-java-driver-2.12.1.jar:na] at com.mongodb.util.JSON.serialize(JSON.java:40) ~[mongo-java-driver-2.12.1.jar:na] at com.mongodb.BasicDBObject.toString(BasicDBObject.java:83) ~[mongo-java-driver-2.12.1.jar:na] at org.springframework.data.mongodb.core.query.Update.toString(Update.java:375) ~[spring-data-mongodb-1.5.1.RELEASE.jar:na] at java.util.Formatter$FormatSpecifier.printString(Formatter.java:2838) ~[na:1.7.0_55] at java.util.Formatter$FormatSpecifier.print(Formatter.java:2718) ~[na:1.7.0_55] at java.util.Formatter.format(Formatter.java:2488) ~[na:1.7.0_55] at java.util.Formatter.format(Formatter.java:2423) ~[na:1.7.0_55] at java.lang.String.format(String.java:2797) ~[na:1.7.0_55] {noformat} In the operation we are trying to perform 'DocRecipient' , a POJO, is being updated in the main document through a findAndModify call. Initial creation of the document had no issues and many documents with other DocRecipients are successfully created and updated - but on the cases where they fail they consistently with the stack trace above JSON of the sample document which failed is shown below : it looks no different than the ones which pass. the JSON was printed in log using jackson {noformat} { "state" : "SEEN", "_id" : "547bd935e4b0ee388a96ad0d", "fullName" : "haksdfj", "email" : "xyz@gmail.com", "token" : "547bd935e4b0ee388a96ad0e", "signRequired" : false, "fieldInputs" : [ { "fieldPosition" : "0.0", "state" : "NOTFILLED" }, { "fieldPosition" : "0.1", "state" : "NOTFILLED" } ], "readOutMessage" : "I haksdfj agree to ....", "videoDuration" : 10, "timeAccessed" : 1417560518713 } {noformat}
    via by Manoj Kurup,
  • {noformat} java.lang.RuntimeException: json can't serialize type : class com.viditure.entities.DocRecipient at com.mongodb.util.ClassMapBasedObjectSerializer.serialize(ClassMapBasedObjectSerializer.java:77) ~[mongo-java-driver-2.12.1.jar:na] at com.mongodb.util.JSONSerializers$MapSerializer.serialize(JSONSerializers.java:317) ~[mongo-java-driver-2.12.1.jar:na] at com.mongodb.util.ClassMapBasedObjectSerializer.serialize(ClassMapBasedObjectSerializer.java:79) ~[mongo-java-driver-2.12.1.jar:na] at com.mongodb.util.JSONSerializers$MapSerializer.serialize(JSONSerializers.java:317) ~[mongo-java-driver-2.12.1.jar:na] at com.mongodb.util.ClassMapBasedObjectSerializer.serialize(ClassMapBasedObjectSerializer.java:79) ~[mongo-java-driver-2.12.1.jar:na] at com.mongodb.util.JSON.serialize(JSON.java:55) ~[mongo-java-driver-2.12.1.jar:na] at com.mongodb.util.JSON.serialize(JSON.java:40) ~[mongo-java-driver-2.12.1.jar:na] at com.mongodb.BasicDBObject.toString(BasicDBObject.java:83) ~[mongo-java-driver-2.12.1.jar:na] at org.springframework.data.mongodb.core.query.Update.toString(Update.java:375) ~[spring-data-mongodb-1.5.1.RELEASE.jar:na] at java.util.Formatter$FormatSpecifier.printString(Formatter.java:2838) ~[na:1.7.0_55] at java.util.Formatter$FormatSpecifier.print(Formatter.java:2718) ~[na:1.7.0_55] at java.util.Formatter.format(Formatter.java:2488) ~[na:1.7.0_55] at java.util.Formatter.format(Formatter.java:2423) ~[na:1.7.0_55] at java.lang.String.format(String.java:2797) ~[na:1.7.0_55] {noformat} In the operation we are trying to perform 'DocRecipient' , a POJO, is being updated in the main document through a findAndModify call. Initial creation of the document had no issues and many documents with other DocRecipients are successfully created and updated - but on the cases where they fail they consistently with the stack trace above JSON of the sample document which failed is shown below : it looks no different than the ones which pass. the JSON was printed in log using jackson {noformat} { "state" : "SEEN", "_id" : "547bd935e4b0ee388a96ad0d", "fullName" : "haksdfj", "email" : "xyz@gmail.com", "token" : "547bd935e4b0ee388a96ad0e", "signRequired" : false, "fieldInputs" : [ { "fieldPosition" : "0.0", "state" : "NOTFILLED" }, { "fieldPosition" : "0.1", "state" : "NOTFILLED" } ], "readOutMessage" : "I haksdfj agree to ....", "videoDuration" : 10, "timeAccessed" : 1417560518713 } {noformat}
    via by Manoj Kurup,
  • 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.
    via by Poorna Subhash,
  • 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.
    via by Poorna Subhash,
    • java.lang.RuntimeException: json can't serialize type : class org.joda.time.DateTime 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 org.springframework.data.mongodb.core.query.Update.toString(Update.java:375)

    Users with the same issue

    Unknown visitor
    Unknown visitor1 times, last one,
    Unknown visitor
    Unknown visitor1 times, last one,
    Unknown visitor
    Unknown visitor1 times, last one,
    Unknown visitor
    Unknown visitor1 times, last one,