java.lang.RuntimeException: json can't serialize type : class database.models.revision.DocumentManualRevision$State

Spring JIRA | yami.veranes | 5 months 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 I upgrade from version 1.8.4.RELEASE to 1.9.3.RELEASE, I have some problems with serialization of DBRef and Enum *_@Query(fields = "{ 'text' : 0, 'statistics' : 0}") Page<DocumentManualRevision> findByRevisor(User revisor, Pageable p);_* the execution of the previous function (where revisor is a dbref of other collection) return the following exception java.lang.RuntimeException: json can't serialize type : class database.models.security.User at com.mongodb.util.ClassMapBasedObjectSerializer.serialize(ClassMapBasedObjectSerializer.java:79) at com.mongodb.util.JSONSerializers$MapSerializer.serialize(JSONSerializers.java:323) at com.mongodb.util.ClassMapBasedObjectSerializer.serialize(ClassMapBasedObjectSerializer.java:82) at com.mongodb.util.JSON.serialize(JSON.java:53) at com.mongodb.util.JSON.serialize(JSON.java:39) at com.mongodb.BasicDBObject.toString(BasicDBObject.java:196) at org.springframework.data.mongodb.repository.query.PartTreeMongoQuery.createQuery(PartTreeMongoQuery.java:113) at org.springframework.data.mongodb.repository.query.AbstractMongoQuery.execute(AbstractMongoQuery.java:81) at org.springframework.data.repository.core.support.RepositoryFactorySupport$QueryExecutorMethodInterceptor.doInvoke(RepositoryFactorySupport.java:482) at org.springframework.data.repository.core.support.RepositoryFactorySupport$QueryExecutorMethodInterceptor.invoke(RepositoryFactorySupport.java:460) at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:179) at org.springframework.data.projection.DefaultMethodInvokingMethodInterceptor.invoke(DefaultMethodInvokingMethodInterceptor.java:61) at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:179) at org.springframework.aop.interceptor.ExposeInvocationInterceptor.invoke(ExposeInvocationInterceptor.java:92) at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:179) at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:213) at com.sun.proxy.$Proxy56.findByRevisorAndCreatedBetween(Unknown Source) *@Query(fields = "{ 'text' : 0, 'statistics' : 0}") Page<DocumentManualRevision> findByState(State state, Pageable p)* the execution of the previous function (where state is enum) return the following exception java.lang.RuntimeException: json can't serialize type : class database.models.revision.DocumentManualRevision$State at com.mongodb.util.ClassMapBasedObjectSerializer.serialize(ClassMapBasedObjectSerializer.java:79) at com.mongodb.util.JSONSerializers$MapSerializer.serialize(JSONSerializers.java:323) at com.mongodb.util.ClassMapBasedObjectSerializer.serialize(ClassMapBasedObjectSerializer.java:82) at com.mongodb.util.JSON.serialize(JSON.java:53) at com.mongodb.util.JSON.serialize(JSON.java:39) at com.mongodb.BasicDBObject.toString(BasicDBObject.java:196) at org.springframework.data.mongodb.repository.query.PartTreeMongoQuery.createQuery(PartTreeMongoQuery.java:113) at org.springframework.data.mongodb.repository.query.AbstractMongoQuery.execute(AbstractMongoQuery.java:81) at org.springframework.data.repository.core.support.RepositoryFactorySupport$QueryExecutorMethodInterceptor.doInvoke(RepositoryFactorySupport.java:482)

    Spring JIRA | 5 months ago | yami.veranes
    java.lang.RuntimeException: json can't serialize type : class database.models.revision.DocumentManualRevision$State
  2. 0

    With version 1.8.2.RELEASE, our enum maps correctly to a string in the DB and vica versa. If I simply change the spring-data-mongo version to 1.9.1.RELEASE, it breaks with the following stacktrace: {code:java} java.lang.RuntimeException: json can't serialize type : class com.bol.service.olg.server.beans.EmbeddedSocialListBean$SocialListType at com.mongodb.util.ClassMapBasedObjectSerializer.serialize(ClassMapBasedObjectSerializer.java:79) at com.mongodb.util.JSONSerializers$MapSerializer.serialize(JSONSerializers.java:323) at com.mongodb.util.ClassMapBasedObjectSerializer.serialize(ClassMapBasedObjectSerializer.java:82) at com.mongodb.util.JSON.serialize(JSON.java:53) at com.mongodb.util.JSON.serialize(JSON.java:39) at com.mongodb.BasicDBObject.toString(BasicDBObject.java:196) at org.springframework.data.mongodb.repository.query.PartTreeMongoQuery.createQuery(PartTreeMongoQuery.java:113) at org.springframework.data.mongodb.repository.query.AbstractMongoQuery.execute(AbstractMongoQuery.java:81) at org.springframework.data.repository.core.support.RepositoryFactorySupport$QueryExecutorMethodInterceptor.doInvoke(RepositoryFactorySupport.java:482) at org.springframework.data.repository.core.support.RepositoryFactorySupport$QueryExecutorMethodInterceptor.invoke(RepositoryFactorySupport.java:460) {code} Was the enum mapping feature removed from version 1.9.1 ?

    Spring JIRA | 10 months ago | Agoston Horvath
    java.lang.RuntimeException: json can't serialize type : class com.bol.service.olg.server.beans.EmbeddedSocialListBean$SocialListType
  3. 0

    With version 1.8.2.RELEASE, our enum maps correctly to a string in the DB and vica versa. If I simply change the spring-data-mongo version to 1.9.1.RELEASE, it breaks with the following stacktrace: {code:java} java.lang.RuntimeException: json can't serialize type : class com.bol.service.olg.server.beans.EmbeddedSocialListBean$SocialListType at com.mongodb.util.ClassMapBasedObjectSerializer.serialize(ClassMapBasedObjectSerializer.java:79) at com.mongodb.util.JSONSerializers$MapSerializer.serialize(JSONSerializers.java:323) at com.mongodb.util.ClassMapBasedObjectSerializer.serialize(ClassMapBasedObjectSerializer.java:82) at com.mongodb.util.JSON.serialize(JSON.java:53) at com.mongodb.util.JSON.serialize(JSON.java:39) at com.mongodb.BasicDBObject.toString(BasicDBObject.java:196) at org.springframework.data.mongodb.repository.query.PartTreeMongoQuery.createQuery(PartTreeMongoQuery.java:113) at org.springframework.data.mongodb.repository.query.AbstractMongoQuery.execute(AbstractMongoQuery.java:81) at org.springframework.data.repository.core.support.RepositoryFactorySupport$QueryExecutorMethodInterceptor.doInvoke(RepositoryFactorySupport.java:482) at org.springframework.data.repository.core.support.RepositoryFactorySupport$QueryExecutorMethodInterceptor.invoke(RepositoryFactorySupport.java:460) {code} Was the enum mapping feature removed from version 1.9.1 ?

    Spring JIRA | 10 months ago | Agoston Horvath
    java.lang.RuntimeException: json can't serialize type : class com.bol.service.olg.server.beans.EmbeddedSocialListBean$SocialListType
  4. Speed up your debug routine!

    Automated exception search integrated into your IDE

  5. 0

    after upgrading from 1.3.7.RELEASE to 1.4.0.RELEASE mongodb driver throws json serialize exception

    GitHub | 6 months ago | ranadeepak
    java.lang.RuntimeException: json can't serialize type : class com.pb.lunchandlearn.domain.TrainingStatus
  6. 0

    KunderaMongo - Issues with JSON Serialization

    GitHub | 3 years ago | pdirksen
    java.lang.RuntimeException: json can't serialize type : class de.cebitec.gendb.persistence.TestFeature

    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 database.models.revision.DocumentManualRevision$State

      at com.mongodb.util.ClassMapBasedObjectSerializer.serialize()
    2. MongoDB Java Driver
      BasicDBObject.toString
      1. com.mongodb.util.ClassMapBasedObjectSerializer.serialize(ClassMapBasedObjectSerializer.java:79)
      2. com.mongodb.util.JSONSerializers$MapSerializer.serialize(JSONSerializers.java:323)
      3. com.mongodb.util.ClassMapBasedObjectSerializer.serialize(ClassMapBasedObjectSerializer.java:82)
      4. com.mongodb.util.JSON.serialize(JSON.java:53)
      5. com.mongodb.util.JSON.serialize(JSON.java:39)
      6. com.mongodb.BasicDBObject.toString(BasicDBObject.java:196)
      6 frames
    3. Spring Data MongoDB - Core
      AbstractMongoQuery.execute
      1. org.springframework.data.mongodb.repository.query.PartTreeMongoQuery.createQuery(PartTreeMongoQuery.java:113)
      2. org.springframework.data.mongodb.repository.query.AbstractMongoQuery.execute(AbstractMongoQuery.java:81)
      2 frames
    4. Spring Data Core
      RepositoryFactorySupport$QueryExecutorMethodInterceptor.doInvoke
      1. org.springframework.data.repository.core.support.RepositoryFactorySupport$QueryExecutorMethodInterceptor.doInvoke(RepositoryFactorySupport.java:482)
      1 frame