users@jax-ws.java.net

NullPointerException

From: Alex Vb <i8c.alex_at_gmail.com>
Date: Mon, 19 Dec 2011 07:19:06 +0100

I have created a JAX-WS client and am trying to execute a webservice that
has a nillable output. As long as the output isn't nil, everything works
just fine, however if the webservice simply returns the root element with
xsi:nil="true", I get the following exception:

Caused by: java.lang.NullPointerException
    at <MyClass>$JaxbAccessorF_log.
get(FieldAccessor_Ref.java:56)
    at
com.sun.xml.bind.v2.runtime.property.SingleReferenceNodeProperty$1.get(SingleReferenceNodeProperty.java:145)
    at
com.sun.xml.bind.v2.runtime.reflect.Accessor.getUnadapted(Accessor.java:147)
    at
com.sun.xml.bind.v2.runtime.JAXBContextImpl$6.get(JAXBContextImpl.java:966)
    at
com.sun.xml.ws.client.sei.ResponseBuilder$DocLit$PartBuilder.readResponse(ResponseBuilder.java:603)
    at
com.sun.xml.ws.client.sei.ResponseBuilder$DocLit.readResponse(ResponseBuilder.java:559)
    at
com.sun.xml.ws.client.sei.SyncMethodHandler.invoke(SyncMethodHandler.java:125)
    at
com.sun.xml.ws.client.sei.SyncMethodHandler.invoke(SyncMethodHandler.java:93)
    at com.sun.xml.ws.client.sei.SEIStub.invoke(SEIStub.java:144)
    at $Proxy43.current(Unknown Source)

The XML amounts to:
<root:currentResponse xsi:nil="true"/>

I have traced the NullPointerException to
com.sun.xml.bind.v2.runtime.reflect.opt.FieldAccessor_Ref, the get(Object
bean) simply does:

return ((Bean)bean).f_ref;

However in this scenario the bean is "null". I have already reported this
to the JAXB mailing list but there it was suggested that JAX-WS might be at
fault for sending along the "null" in the first place.
Is this a JAX-WS bug or did I configure something wrong or...?

JAXB list reference:
http://java.net/projects/jaxb/lists/users/archive/2011-12/message/16