java.lang.IllegalStateException: No ObjectCodec defined for the generator, can only serialize simple wrapper types (type passed java.util.Date)

Spring JIRA | Jaime L. López Carratalá | 3 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

    I have a POJO with a java.util.Date attribute in it and when the POJO is being saved I get this error: java.lang.IllegalStateException: No ObjectCodec defined for the generator, can only serialize simple wrapper types (type passed java.util.Date) at com.fasterxml.jackson.core.base.GeneratorBase._writeSimpleObject(GeneratorBase.java:515) at com.fasterxml.jackson.core.base.GeneratorBase.writeObject(GeneratorBase.java:262) at org.springframework.data.couchbase.core.convert.translation.JacksonTranslationService.encodeRecursive(JacksonTranslationService.java:93) at org.springframework.data.couchbase.core.convert.translation.JacksonTranslationService.encode(JacksonTranslationService.java:60) at org.springframework.data.couchbase.core.CouchbaseTemplate.translateEncode(CouchbaseTemplate.java:84) at org.springframework.data.couchbase.core.CouchbaseTemplate.access$000(CouchbaseTemplate.java:49) at org.springframework.data.couchbase.core.CouchbaseTemplate$2.doInBucket(CouchbaseTemplate.java:120) at org.springframework.data.couchbase.core.CouchbaseTemplate$2.doInBucket(CouchbaseTemplate.java:117) at org.springframework.data.couchbase.core.CouchbaseTemplate.execute(CouchbaseTemplate.java:234) at org.springframework.data.couchbase.core.CouchbaseTemplate.save(CouchbaseTemplate.java:117) at org.springframework.data.couchbase.repository.support.SimpleCouchbaseRepository.save(SimpleCouchbaseRepository.java:82) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ... The problem seems to be that in JacksonTranslationService.encodeRecursive, the Date is detected as a symple type but then in the jackson core the Date object is not supported, is there any way to translate the dates to JSON?

    Spring JIRA | 3 years ago | Jaime L. López Carratalá
    java.lang.IllegalStateException: No ObjectCodec defined for the generator, can only serialize simple wrapper types (type passed java.util.Date)
  2. 0

    I have a POJO with a java.util.Date attribute in it and when the POJO is being saved I get this error: java.lang.IllegalStateException: No ObjectCodec defined for the generator, can only serialize simple wrapper types (type passed java.util.Date) at com.fasterxml.jackson.core.base.GeneratorBase._writeSimpleObject(GeneratorBase.java:515) at com.fasterxml.jackson.core.base.GeneratorBase.writeObject(GeneratorBase.java:262) at org.springframework.data.couchbase.core.convert.translation.JacksonTranslationService.encodeRecursive(JacksonTranslationService.java:93) at org.springframework.data.couchbase.core.convert.translation.JacksonTranslationService.encode(JacksonTranslationService.java:60) at org.springframework.data.couchbase.core.CouchbaseTemplate.translateEncode(CouchbaseTemplate.java:84) at org.springframework.data.couchbase.core.CouchbaseTemplate.access$000(CouchbaseTemplate.java:49) at org.springframework.data.couchbase.core.CouchbaseTemplate$2.doInBucket(CouchbaseTemplate.java:120) at org.springframework.data.couchbase.core.CouchbaseTemplate$2.doInBucket(CouchbaseTemplate.java:117) at org.springframework.data.couchbase.core.CouchbaseTemplate.execute(CouchbaseTemplate.java:234) at org.springframework.data.couchbase.core.CouchbaseTemplate.save(CouchbaseTemplate.java:117) at org.springframework.data.couchbase.repository.support.SimpleCouchbaseRepository.save(SimpleCouchbaseRepository.java:82) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ... The problem seems to be that in JacksonTranslationService.encodeRecursive, the Date is detected as a symple type but then in the jackson core the Date object is not supported, is there any way to translate the dates to JSON?

    Spring JIRA | 3 years ago | Jaime L. López Carratalá
    java.lang.IllegalStateException: No ObjectCodec defined for the generator, can only serialize simple wrapper types (type passed java.util.Date)
  3. 0

    I have a POJO with a java.util.Date attribute in it and when the POJO is being saved I get this error: java.lang.IllegalStateException: No ObjectCodec defined for the generator, can only serialize simple wrapper types (type passed java.util.Date) at com.fasterxml.jackson.core.base.GeneratorBase._writeSimpleObject(GeneratorBase.java:515) at com.fasterxml.jackson.core.base.GeneratorBase.writeObject(GeneratorBase.java:262) at org.springframework.data.couchbase.core.convert.translation.JacksonTranslationService.encodeRecursive(JacksonTranslationService.java:93) at org.springframework.data.couchbase.core.convert.translation.JacksonTranslationService.encode(JacksonTranslationService.java:60) at org.springframework.data.couchbase.core.CouchbaseTemplate.translateEncode(CouchbaseTemplate.java:84) at org.springframework.data.couchbase.core.CouchbaseTemplate.access$000(CouchbaseTemplate.java:49) at org.springframework.data.couchbase.core.CouchbaseTemplate$2.doInBucket(CouchbaseTemplate.java:120) at org.springframework.data.couchbase.core.CouchbaseTemplate$2.doInBucket(CouchbaseTemplate.java:117) at org.springframework.data.couchbase.core.CouchbaseTemplate.execute(CouchbaseTemplate.java:234) at org.springframework.data.couchbase.core.CouchbaseTemplate.save(CouchbaseTemplate.java:117) at org.springframework.data.couchbase.repository.support.SimpleCouchbaseRepository.save(SimpleCouchbaseRepository.java:82) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ... The problem seems to be that in JacksonTranslationService.encodeRecursive, the Date is detected as a symple type but then in the jackson core the Date object is not supported, is there any way to translate the dates to JSON?

    Spring JIRA | 3 years ago | Jaime L. López Carratalá
    java.lang.IllegalStateException: No ObjectCodec defined for the generator, can only serialize simple wrapper types (type passed java.util.Date)
  4. Speed up your debug routine!

    Automated exception search integrated into your IDE

  5. 0

    I have a POJO with a java.util.Date attribute in it and when the POJO is being saved I get this error: java.lang.IllegalStateException: No ObjectCodec defined for the generator, can only serialize simple wrapper types (type passed java.util.Date) at com.fasterxml.jackson.core.base.GeneratorBase._writeSimpleObject(GeneratorBase.java:515) at com.fasterxml.jackson.core.base.GeneratorBase.writeObject(GeneratorBase.java:262) at org.springframework.data.couchbase.core.convert.translation.JacksonTranslationService.encodeRecursive(JacksonTranslationService.java:93) at org.springframework.data.couchbase.core.convert.translation.JacksonTranslationService.encode(JacksonTranslationService.java:60) at org.springframework.data.couchbase.core.CouchbaseTemplate.translateEncode(CouchbaseTemplate.java:84) at org.springframework.data.couchbase.core.CouchbaseTemplate.access$000(CouchbaseTemplate.java:49) at org.springframework.data.couchbase.core.CouchbaseTemplate$2.doInBucket(CouchbaseTemplate.java:120) at org.springframework.data.couchbase.core.CouchbaseTemplate$2.doInBucket(CouchbaseTemplate.java:117) at org.springframework.data.couchbase.core.CouchbaseTemplate.execute(CouchbaseTemplate.java:234) at org.springframework.data.couchbase.core.CouchbaseTemplate.save(CouchbaseTemplate.java:117) at org.springframework.data.couchbase.repository.support.SimpleCouchbaseRepository.save(SimpleCouchbaseRepository.java:82) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ... The problem seems to be that in JacksonTranslationService.encodeRecursive, the Date is detected as a symple type but then in the jackson core the Date object is not supported, is there any way to translate the dates to JSON?

    Spring JIRA | 3 years ago | Jaime L. López Carratalá
    java.lang.IllegalStateException: No ObjectCodec defined for the generator, can only serialize simple wrapper types (type passed java.util.Date)

    Root Cause Analysis

    1. java.lang.IllegalStateException

      No ObjectCodec defined for the generator, can only serialize simple wrapper types (type passed java.util.Date)

      at com.fasterxml.jackson.core.base.GeneratorBase._writeSimpleObject()
    2. Jackson-core
      GeneratorBase.writeObject
      1. com.fasterxml.jackson.core.base.GeneratorBase._writeSimpleObject(GeneratorBase.java:515)
      2. com.fasterxml.jackson.core.base.GeneratorBase.writeObject(GeneratorBase.java:262)
      2 frames
    3. Spring Data Couchbase
      SimpleCouchbaseRepository.save
      1. org.springframework.data.couchbase.core.convert.translation.JacksonTranslationService.encodeRecursive(JacksonTranslationService.java:93)
      2. org.springframework.data.couchbase.core.convert.translation.JacksonTranslationService.encode(JacksonTranslationService.java:60)
      3. org.springframework.data.couchbase.core.CouchbaseTemplate.translateEncode(CouchbaseTemplate.java:84)
      4. org.springframework.data.couchbase.core.CouchbaseTemplate.access$000(CouchbaseTemplate.java:49)
      5. org.springframework.data.couchbase.core.CouchbaseTemplate$2.doInBucket(CouchbaseTemplate.java:120)
      6. org.springframework.data.couchbase.core.CouchbaseTemplate$2.doInBucket(CouchbaseTemplate.java:117)
      7. org.springframework.data.couchbase.core.CouchbaseTemplate.execute(CouchbaseTemplate.java:234)
      8. org.springframework.data.couchbase.core.CouchbaseTemplate.save(CouchbaseTemplate.java:117)
      9. org.springframework.data.couchbase.repository.support.SimpleCouchbaseRepository.save(SimpleCouchbaseRepository.java:82)
      9 frames
    4. Java RT
      NativeMethodAccessorImpl.invoke0
      1. sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
      1 frame