users@jersey.java.net

Re: [Jersey] Null pointer exception in jaxb unmarshalling

From: Tatu Saloranta <tsaloranta_at_gmail.com>
Date: Thu, 12 Mar 2009 13:07:08 -0700

On Thu, Mar 12, 2009 at 12:10 PM, Erdinc Yilmazel <erdinc_at_yilmazel.com> wrote:
> Well I'm not sure if this is the right place to post this message, but
> here it goes.
> I am getting a null pointer exception while jersey client tries to
> unmarshall the returned xml from the web service.
...
> Both RegistryEntry and Unit classes are simple java classes
> (containing only simple types of attributes like primitives and
> string) both annotated with XmlRootElement.

This is just a wild guess, but could it be due to auto-unboxing
operation used to convert from wrapper type like Integer to primitive
type like int?
That is, if attribute/element is missing value, that could be taken to
mean null, and trying to assign or pass it as an argument to primitive
type would give you a strange NPE. I haven't seen this with Jersey,
but have encountered it with some other code.

-+ Tatu +-