users@jersey.java.net

[Jersey] jackson json mapping issue

From: suchitha koneru <suchi.koneru_at_gmail.com>
Date: Tue, 26 Jun 2012 11:12:56 -0700

Hello Jersey Users,
       We are using jersey-server, jersery -client and jersey-json jars of
 version 1.11 in our application which runs on a jetty server. I get the
following exception when json is being deserialized into Retailer pojo (the
pojo is attached and it is generated by using xjc compiler from Retailer
XSD). Both Retailer and Retailer countrty pojos have a inner class
Supported Currencies with different definition. I think this is causing the
issue.


Caused by: org.codehaus.jackson.map.JsonMappingException: Can not
deserialize instance of
com.bn.cloud.pm.data.vo.catalog.retl.Retailer$SupportedCurrencies out of
START_ARRAY token
 at [Source: java.io.ByteArrayInputStream_at_3bdd6a67; line: 1, column: 101]
(through reference chain:
com.bn.cloud.pm.data.vo.catalog.retl.Retailer["supportedCurrencies"])
at
org.codehaus.jackson.map.JsonMappingException.from(JsonMappingException.java:163)
~[jackson-mapper-asl-1.9.2.jar:1.9.2]
at
org.codehaus.jackson.map.deser.StdDeserializationContext.mappingException(StdDeserializationContext.java:219)
~[jackson-mapper-asl-1.9.2.jar:1.9.2]
at
org.codehaus.jackson.map.deser.StdDeserializationContext.mappingException(StdDeserializationContext.java:212)
~[jackson-mapper-asl-1.9.2.jar:1.9.2]
at
org.codehaus.jackson.map.deser.BeanDeserializer.deserializeFromArray(BeanDeserializer.java:869)
~[jackson-mapper-asl-1.9.2.jar:1.9.2]
at
org.codehaus.jackson.map.deser.BeanDeserializer.deserialize(BeanDeserializer.java:597)
~[jackson-mapper-asl-1.9.2.jar:1.9.2]
at
org.codehaus.jackson.map.deser.SettableBeanProperty.deserialize(SettableBeanProperty.java:299)
~[jackson-mapper-asl-1.9.2.jar:1.9.2]
at
org.codehaus.jackson.map.deser.SettableBeanProperty$FieldProperty.deserializeAndSet(SettableBeanProperty.java:579)
~[jackson-mapper-asl-1.9.2.jar:1.9.2]
at
org.codehaus.jackson.map.deser.BeanDeserializer.deserializeFromObject(BeanDeserializer.java:697)
~[jackson-mapper-asl-1.9.2.jar:1.9.2]
at
org.codehaus.jackson.map.deser.BeanDeserializer.deserialize(BeanDeserializer.java:580)
~[jackson-mapper-asl-1.9.2.jar:1.9.2]
at org.codehaus.jackson.map.ObjectMapper._readValue(ObjectMapper.java:2695)
~[jackson-mapper-asl-1.9.2.jar:1.9.2]
at org.codehaus.jackson.map.ObjectMapper.readValue(ObjectMapper.java:1308)
~[jackson-mapper-asl-1.9.2.jar:1.9.2]
at
org.codehaus.jackson.jaxrs.JacksonJsonProvider.readFrom(JacksonJsonProvider.java:419)
~[jackson-jaxrs-1.9.2.jar:1.9.2]
at
com.sun.jersey.json.impl.provider.entity.JacksonProviderProxy.readFrom(JacksonProviderProxy.java:139)
~[jersey-json-1.11.jar:1.11]
at
com.sun.jersey.api.client.ClientResponse.getEntity(ClientResponse.java:554)
~[jersey-client-1.11.jar:1.11]

I suspect the issue is

http://jira.codehaus.org/browse/JACKSON-743


I am not aware of any work arounds. Could you please suggest what can be
done to solve this issue ?


Thank you,
Suchitha