Ok, finally found out where the bug is. The key was in the line:
at
com.myapp.data.Base$JaxbAccessorM_getId_setId_java_lang_Object.set(MethodAccessor_Ref.java:56)
I actually had a Base data object like so:
@MappedSuperclass
abstract public class Base<K> implements Serializable {
<other fields and methods deleted>
public abstract K getId();
public abstract void setId(K id);
}
The expedient of changing K to Long (all my currently implemented
objects have Long as Id) caused both the client side receiving and the
server side streaming to work just fine. Well, it now returns "id" :
[3, 3], which is at least usable...
I'm not sure whether there's a way to get around it or it is an issue
with Jettison, but at least I'm able to get forward. thanks!
Jeff
On Fri, Dec 9, 2011 at 2:19 PM, Sergey Beryozkin <[email protected]> wrote:
> See this section:
> http://cxf.apache.org/docs/jax-rs-data-bindings.html#JAX-RSDataBindings-Jettison
>
> Sergey
>
>
> On 09/12/11 17:42, Jeff Wang wrote:
>>
>> So you mean I should remove the writeXsiType false setting, and set up
>> the xs namespace on the client-side? Or is there another namespace
>> that I should be using?
>>
>> I'm using CXF 2.4.2 and Jettison 1.3
>>
>> thanks
>> Jeff
>>
>> On Fri, Dec 9, 2011 at 9:20 AM, Sergey Beryozkin<[email protected]>
>> wrote:
>>>
>>> On 09/12/11 17:08, Jeff Wang wrote:
>>>>
>>>>
>>>> On Fri, Dec 9, 2011 at 8:56 AM, Jeff Wang<[email protected]> wrote:
>>>>>
>>>>>
>>>>> 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
>>>>
>>>>
>>>>
>>>> Aha! with writeXsiType to false on the server side, I got the full
>>>> stack trace on the client side:
>>>>
>>>> Caused by: java.lang.ClassCastException:
>>>> com.sun.org.apache.xerces.internal.dom.ElementNSImpl cannot be cast to
>>>> java.lang.Long
>>>> at com.myapp.data.User.setId(User.java:1)
>>>> at
>>>>
>>>> com.myapp.data.Base$JaxbAccessorM_getId_setId_java_lang_Object.set(MethodAccessor_Ref.java:56)
>>>> at
>>>> com.sun.xml.bind.v2.runtime.reflect.Accessor.receive(Accessor.java:173)
>>>> <snip a bunch more xml bind stacks...>
>>>> at
>>>>
>>>> org.apache.cxf.jaxrs.provider.JSONProvider.readFrom(JSONProvider.java:197)
>>>>
>>> Please set up a JSON namespace map on the receiving side; by the way this
>>> exception seems vaguely familiar to me, it may have been fixed in
>>> Jettison
>>> 1.3, which CXF version do you work with ?
>>>
>>> Cheers, Sergey
>>>>
>>>>
>>>> thanks,
>>>> Jeff
>
>
>
> --
> Sergey Beryozkin
>
> Talend Community Coders
> http://coders.talend.com/
>
> Blog: http://sberyozkin.blogspot.com