简体   繁体   中英

org.codehaus.jackson.map.JsonMappingException

Getting exception while Deserializing the object ( LinkedHashMap > ).

org.codehaus.jackson.map.JsonMappingException: (was java.lang.NullPointerException) (through reference chain: java.util.LinkedHashMap["da0a11ef-7ced-4840-b7f8-2e7f4e8f7816"]->java.util.ArrayList[0]->java.util.ArrayList[0]->com.acti.interaction.jdo.InteractionJDO["key"]->com.google.appengine.api.datastore.Key["namespace"])

Tried @JsonIgnore for the key property in the JDO, but no luck.

This exception occurs when the POJO does not contain an explicit default/non-parameterized constructor. So adding a default constructor will usually get it fixed. (When you create a Java object from the json string...the ObjectMapper will usually make use of the default constructor of the Java class you are currently marshalling/unmarshalling to/from.)

Hi Ganesh I faced the same issue. its because inside ur Json key value pair the one of the value also contains the key and corresponding pair like this,

"linkedContactMethods": [
    {
        "key": {
            "kind": "ContactMethod",
            "appId": "s~staging-contactsapi",
            "id": 5629499534213120,

and i was getting the same exception which u are getting. i soleved this by by making that as null because that value of no use for me. like this

"linkedContactMethods": null,

and after this i'm able to get the desired data.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM