java.lang.RuntimeException: json can't serialize type : class com.pb.lunchandlearn.domain.TrainingStatus

GitHub | ranadeepak | 3 months ago
  1. 0

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

    GitHub | 3 months ago | ranadeepak
    java.lang.RuntimeException: json can't serialize type : class com.pb.lunchandlearn.domain.TrainingStatus
  2. 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 | 2 months ago | yami.veranes
    java.lang.RuntimeException: json can't serialize type : class database.models.security.User
  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 | 8 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

    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 | 8 months ago | Agoston Horvath
    java.lang.RuntimeException: json can't serialize type : class com.bol.service.olg.server.beans.EmbeddedSocialListBean$SocialListType
  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 com.pb.lunchandlearn.domain.TrainingStatus

      at com.mongodb.util.ClassMapBasedObjectSerializer.serialize()
    2. MongoDB Java Driver
      BasicDBObject.toString
      1. com.mongodb.util.ClassMapBasedObjectSerializer.serialize(ClassMapBasedObjectSerializer.java:79)[mongodb-driver-3.2.2.jar:na]
      2. com.mongodb.util.JSONSerializers$MapSerializer.serialize(JSONSerializers.java:323)[mongodb-driver-3.2.2.jar:na]
      3. com.mongodb.util.ClassMapBasedObjectSerializer.serialize(ClassMapBasedObjectSerializer.java:82)[mongodb-driver-3.2.2.jar:na]
      4. com.mongodb.util.JSON.serialize(JSON.java:53)[mongodb-driver-3.2.2.jar:na]
      5. com.mongodb.util.JSON.serialize(JSON.java:39)[mongodb-driver-3.2.2.jar:na]
      6. com.mongodb.BasicDBObject.toString(BasicDBObject.java:196)[mongodb-driver-3.2.2.jar:na]
      6 frames
    3. Spring Data MongoDB - Core
      AbstractMongoQuery.execute
      1. org.springframework.data.mongodb.repository.query.PartTreeMongoQuery.createQuery(PartTreeMongoQuery.java:113)[spring-data-mongodb-1.9.2.RELEASE.jar:na]
      2. org.springframework.data.mongodb.repository.query.AbstractMongoQuery.execute(AbstractMongoQuery.java:81)[spring-data-mongodb-1.9.2.RELEASE.jar:na]
      2 frames
    4. Spring Data Core
      RepositoryFactorySupport$QueryExecutorMethodInterceptor.invoke
      1. org.springframework.data.repository.core.support.RepositoryFactorySupport$QueryExecutorMethodInterceptor.doInvoke(RepositoryFactorySupport.java:482)[spring-data-commons-1.12.2.RELEASE.jar:na]
      2. org.springframework.data.repository.core.support.RepositoryFactorySupport$QueryExecutorMethodInterceptor.invoke(RepositoryFactorySupport.java:460)[spring-data-commons-1.12.2.RELEASE.jar:na]
      2 frames
    5. Spring AOP
      ReflectiveMethodInvocation.proceed
      1. org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:179)[spring-aop-4.3.2.RELEASE.jar:4.3.2.RELEASE]
      1 frame
    6. org.springframework.data
      DefaultMethodInvokingMethodInterceptor.invoke
      1. org.springframework.data.projection.DefaultMethodInvokingMethodInterceptor.invoke(DefaultMethodInvokingMethodInterceptor.java:61)[spring-data-commons-1.12.2.RELEASE.jar:na]
      1 frame
    7. Spring AOP
      JdkDynamicAopProxy.invoke
      1. org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:179)[spring-aop-4.3.2.RELEASE.jar:4.3.2.RELEASE]
      2. org.springframework.aop.interceptor.ExposeInvocationInterceptor.invoke(ExposeInvocationInterceptor.java:92)[spring-aop-4.3.2.RELEASE.jar:4.3.2.RELEASE]
      3. org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:179)[spring-aop-4.3.2.RELEASE.jar:4.3.2.RELEASE]
      4. org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:213)[spring-aop-4.3.2.RELEASE.jar:4.3.2.RELEASE]
      4 frames
    8. com.sun.proxy
      $Proxy94.findAllByStatusOrderByScore
      1. com.sun.proxy.$Proxy94.findAllByStatusOrderByScore(Unknown Source)[na:na]
      1 frame
    9. Java RT
      Method.invoke
      1. sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)[na:1.8.0_25]
      2. sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)[na:1.8.0_25]
      3. sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)[na:1.8.0_25]
      4. java.lang.reflect.Method.invoke(Method.java:483)[na:1.8.0_25]
      4 frames
    10. Spring AOP
      JdkDynamicAopProxy.invoke
      1. org.springframework.aop.support.AopUtils.invokeJoinpointUsingReflection(AopUtils.java:333)[spring-aop-4.3.2.RELEASE.jar:4.3.2.RELEASE]
      2. org.springframework.aop.framework.ReflectiveMethodInvocation.invokeJoinpoint(ReflectiveMethodInvocation.java:190)[spring-aop-4.3.2.RELEASE.jar:4.3.2.RELEASE]
      3. org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:157)[spring-aop-4.3.2.RELEASE.jar:4.3.2.RELEASE]
      4. org.springframework.aop.framework.adapter.AfterReturningAdviceInterceptor.invoke(AfterReturningAdviceInterceptor.java:52)[spring-aop-4.3.2.RELEASE.jar:4.3.2.RELEASE]
      5. org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:179)[spring-aop-4.3.2.RELEASE.jar:4.3.2.RELEASE]
      6. org.springframework.aop.interceptor.ExposeInvocationInterceptor.invoke(ExposeInvocationInterceptor.java:92)[spring-aop-4.3.2.RELEASE.jar:4.3.2.RELEASE]
      7. org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:179)[spring-aop-4.3.2.RELEASE.jar:4.3.2.RELEASE]
      8. org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:213)[spring-aop-4.3.2.RELEASE.jar:4.3.2.RELEASE]
      8 frames
    11. com.sun.proxy
      $Proxy94.findAllByStatusOrderByScore
      1. com.sun.proxy.$Proxy94.findAllByStatusOrderByScore(Unknown Source)[na:na]
      1 frame