users@jersey.java.net

[Jersey] Re: Json and polymorphism

From: John Lister <john.lister_at_kickstone.com>
Date: Wed, 26 Jan 2011 07:29:01 +0000

Jersey currently ships with Jackson 1.5.5 (or at least the latest
glassfish version does). I've found that you can normally just swap the
more recent jackson jar files for the ones used by Jersey without
problems. If you're running glassfish, i'd recommend deleting the
osgi-cache before restarting to make sure the right ones are used and
that if you do an update, you re-replace them...

John

On 19:59, Grenzinger Yannick wrote:
>
> Hello,
>
> We are trying to do json serialization and deserialization on
> polymorphic types with this annotation :
>
> @JsonTypeInfo(use=JsonTypeInfo.Id.CLASS,
> include=JsonTypeInfo.As.PROPERTY, property="@class")
>
> The solution advised by Jackson here :
>
> http://wiki.fasterxml.com/JacksonPolymorphicDeserialization
>
> But we have always this error :
>
> com.sun.jersey.api.client.ClientHandlerException:
> org.codehaus.jackson.map.JsonMappingException: Unexpected token
> (END_OBJECT), expected FIELD_NAME: missing property '_at_class' that is
> to contain type id (for class com.vsct.rd.emerch.model.filter.Filter)
>
> This bug seems to be known and corrected in Jackson 1.7 :
>
> http://jira.codehaus.org/browse/JACKSON-356?page=com.atlassian.jira.plugin.system.issuetabpanels%3Aall-tabpanel
>
> What is your current status in Jersey ? (you're using Jackson true ?)
>
> Thanks!
>
> Yannick
>