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

Apereo Issues | Misagh Moayyed | 2 years ago
  1. 0

    The OAuth20ProfileController in CAS-OAuth attempts to want to serialize and marshal all principal attributes. The JSONFactory parser seems to have a problem with multi-valued attributes, which, in my exact case was "objectclass". {code} objectclass=[top, person, organizationalPerson] {code} Exception trace: {code} FBJqRDG7Zl46MUa-https://mmoayyed.test.org> 2014-06-18 10:45:26,427 DEBUG [org.jasig.cas.web.FlowExecutionExceptionResolver] - <Ignoring the received exception due to a type mismatch> java.lang.IllegalStateException: No ObjectCodec defined for the generator, can only serialize simple wrapper types (type passed java.util.Collec ns$UnmodifiableRandomAccessList) at com.fasterxml.jackson.core.base.GeneratorBase._writeSimpleObject(GeneratorBase.java:515) at com.fasterxml.jackson.core.base.GeneratorBase.writeObject(GeneratorBase.java:262) at com.fasterxml.jackson.core.JsonGenerator.writeObjectField(JsonGenerator.java:1114) at org.jasig.cas.support.oauth.web.OAuth20ProfileController.handleRequestInternal(OAuth20ProfileController.java:100) at org.springframework.web.servlet.mvc.AbstractController.handleRequest(AbstractController.java:153) at org.jasig.cas.support.oauth.web.OAuth20WrapperController.internalHandleRequest(OAuth20WrapperController.java:79) at org.jasig.cas.support.oauth.web.BaseOAuthWrapperController.handleRequestInternal(BaseOAuthWrapperController.java:62) at org.springframework.web.servlet.mvc.AbstractController.handleRequest(AbstractController.java:153) at org.springframework.web.servlet.mvc.SimpleControllerHandlerAdapter.handle(SimpleControllerHandlerAdapter.java:48) at org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:923) at org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:852) at org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:882) at org.springframework.web.servlet.FrameworkServlet.doGet(FrameworkServlet.java:778) at javax.servlet.http.HttpServlet.service(HttpServlet.java:621) at javax.servlet.http.HttpServlet.service(HttpServlet.java:728) at org.jasig.cas.web.init.SafeDispatcherServlet.service_aroundBody2(SafeDispatcherServlet.java:128) at org.jasig.cas.web.init.SafeDispatcherServlet.service_aroundBody3$advice(SafeDispatcherServlet.java:57) at org.jasig.cas.web.init.SafeDispatcherServlet.service(SafeDispatcherServlet.java:1) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:305) {code} Also noticed that the code attempts to want to marshal ALL principal attributes into JSON, rather than just what attributes may be allowed for the oauth client service.

    Apereo Issues | 2 years ago | Misagh Moayyed
    java.lang.IllegalStateException: No ObjectCodec defined for the generator, can only serialize simple wrapper types (type passed java.util.Collec ns$UnmodifiableRandomAccessList)
  2. 0

    The OAuth20ProfileController in CAS-OAuth attempts to want to serialize and marshal all principal attributes. The JSONFactory parser seems to have a problem with multi-valued attributes, which, in my exact case was "objectclass". {code} objectclass=[top, person, organizationalPerson] {code} Exception trace: {code} FBJqRDG7Zl46MUa-https://mmoayyed.test.org> 2014-06-18 10:45:26,427 DEBUG [org.jasig.cas.web.FlowExecutionExceptionResolver] - <Ignoring the received exception due to a type mismatch> java.lang.IllegalStateException: No ObjectCodec defined for the generator, can only serialize simple wrapper types (type passed java.util.Collec ns$UnmodifiableRandomAccessList) at com.fasterxml.jackson.core.base.GeneratorBase._writeSimpleObject(GeneratorBase.java:515) at com.fasterxml.jackson.core.base.GeneratorBase.writeObject(GeneratorBase.java:262) at com.fasterxml.jackson.core.JsonGenerator.writeObjectField(JsonGenerator.java:1114) at org.jasig.cas.support.oauth.web.OAuth20ProfileController.handleRequestInternal(OAuth20ProfileController.java:100) at org.springframework.web.servlet.mvc.AbstractController.handleRequest(AbstractController.java:153) at org.jasig.cas.support.oauth.web.OAuth20WrapperController.internalHandleRequest(OAuth20WrapperController.java:79) at org.jasig.cas.support.oauth.web.BaseOAuthWrapperController.handleRequestInternal(BaseOAuthWrapperController.java:62) at org.springframework.web.servlet.mvc.AbstractController.handleRequest(AbstractController.java:153) at org.springframework.web.servlet.mvc.SimpleControllerHandlerAdapter.handle(SimpleControllerHandlerAdapter.java:48) at org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:923) at org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:852) at org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:882) at org.springframework.web.servlet.FrameworkServlet.doGet(FrameworkServlet.java:778) at javax.servlet.http.HttpServlet.service(HttpServlet.java:621) at javax.servlet.http.HttpServlet.service(HttpServlet.java:728) at org.jasig.cas.web.init.SafeDispatcherServlet.service_aroundBody2(SafeDispatcherServlet.java:128) at org.jasig.cas.web.init.SafeDispatcherServlet.service_aroundBody3$advice(SafeDispatcherServlet.java:57) at org.jasig.cas.web.init.SafeDispatcherServlet.service(SafeDispatcherServlet.java:1) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:305) {code} Also noticed that the code attempts to want to marshal ALL principal attributes into JSON, rather than just what attributes may be allowed for the oauth client service.

    Apereo Issues | 2 years ago | Misagh Moayyed
    java.lang.IllegalStateException: No ObjectCodec defined for the generator, can only serialize simple wrapper types (type passed java.util.Collec ns$UnmodifiableRandomAccessList)
  3. 0

    JsonMarshaller.writeExtras does not account for data that cannot be encoded.

    GitHub | 3 years ago | empiricalthought
    java.lang.IllegalStateException: No ObjectCodec defined for the generator, can only serialize simple wrapper types (type passed org.nuxeo.ecm.platform.usermanager.NuxeoPrincipalImpl)
  4. Speed up your debug routine!

    Automated exception search integrated into your IDE

  5. 0

    No ObjectCodec defined for the generator, ... (type passed java.sql.Time)

    GitHub | 1 year ago | io41
    java.lang.IllegalStateException: No ObjectCodec defined for the generator, can only serialize simple wrapper types (type passed java.sql.Time)
  6. 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)

    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.IllegalStateException

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

      at com.fasterxml.jackson.core.base.GeneratorBase._writeSimpleObject()
    2. Jackson-core
      JsonGenerator.writeObjectField
      1. com.fasterxml.jackson.core.base.GeneratorBase._writeSimpleObject(GeneratorBase.java:515)
      2. com.fasterxml.jackson.core.base.GeneratorBase.writeObject(GeneratorBase.java:262)
      3. com.fasterxml.jackson.core.JsonGenerator.writeObjectField(JsonGenerator.java:1114)
      3 frames
    3. org.jasig.cas
      OAuth20ProfileController.handleRequestInternal
      1. org.jasig.cas.support.oauth.web.OAuth20ProfileController.handleRequestInternal(OAuth20ProfileController.java:100)
      1 frame
    4. Spring MVC
      AbstractController.handleRequest
      1. org.springframework.web.servlet.mvc.AbstractController.handleRequest(AbstractController.java:153)
      1 frame
    5. org.jasig.cas
      BaseOAuthWrapperController.handleRequestInternal
      1. org.jasig.cas.support.oauth.web.OAuth20WrapperController.internalHandleRequest(OAuth20WrapperController.java:79)
      2. org.jasig.cas.support.oauth.web.BaseOAuthWrapperController.handleRequestInternal(BaseOAuthWrapperController.java:62)
      2 frames
    6. Spring MVC
      FrameworkServlet.doGet
      1. org.springframework.web.servlet.mvc.AbstractController.handleRequest(AbstractController.java:153)
      2. org.springframework.web.servlet.mvc.SimpleControllerHandlerAdapter.handle(SimpleControllerHandlerAdapter.java:48)
      3. org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:923)
      4. org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:852)
      5. org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:882)
      6. org.springframework.web.servlet.FrameworkServlet.doGet(FrameworkServlet.java:778)
      6 frames
    7. JavaServlet
      HttpServlet.service
      1. javax.servlet.http.HttpServlet.service(HttpServlet.java:621)
      2. javax.servlet.http.HttpServlet.service(HttpServlet.java:728)
      2 frames
    8. Jasig CAS Core
      SafeDispatcherServlet.service
      1. org.jasig.cas.web.init.SafeDispatcherServlet.service_aroundBody2(SafeDispatcherServlet.java:128)
      2. org.jasig.cas.web.init.SafeDispatcherServlet.service_aroundBody3$advice(SafeDispatcherServlet.java:57)
      3. org.jasig.cas.web.init.SafeDispatcherServlet.service(SafeDispatcherServlet.java:1)
      3 frames
    9. Glassfish Core
      ApplicationFilterChain.internalDoFilter
      1. org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:305)
      1 frame