On Fri, Dec 9, 2011 at 8:15 AM, Sergey Beryozkin <[email protected]> wrote:
>
> Is it a JSON sequence ? The error is side-effect of this xsi type which is
> probably not needed for this particular case; you'd need to set up a
> namespace map for JSONProvider if you prefer to keep 'xsi' & 'xs'
>

It's not a sequence.  It's just a POJO with a field with the type
Long.  If I use the simpler type long, there is no xsi type, and the
deserialization on the client works just fine.

> How does the method signature look like and where is this exception
> originating from ?
Method signature:

@POST
@Path("/")
public Response createUser(User user);

The relevant part of user:

@XmlRootElement
public Class User {
    private Long id;
}

the JSON string looks like:
{"user" : {"id" : 1}}

Again, changing the above mapping to long works.  I actually don't
know from where the exception is generated.  The log is:

Exception : 116916 [http-bio-8080-exec-4] WARN
org.apache.cxf.jaxrs.impl.WebApplicationExceptionMapper  -
WebApplicationException has been caught :
com.sun.org.apache.xerces.internal.dom.ElementNSImpl cannot be cast to
java.lang.Long

I'll try the readXsiType/writeXsiType to false and also Jaxson today
and see how it goes.
thanks
Jeff

Reply via email to