users@jaxb.java.net

Re: Null pointer exception during unmarshalling

From: Kohsuke Kawaguchi <Kohsuke.Kawaguchi_at_Sun.COM>
Date: Mon, 23 Feb 2004 14:00:59 -0800

> I use JAXB along with SAAJ in JWSDP 1.3.
>
> I use SAAJ for sending/receving SOAP message. And I use JAXB to build a JAVA object from the SOAP response.
>
> When I use JAXB to unmarshall a SOAP Body element, I got the following null pointer exception.
>
> I think this happesn because the getLocalName() of an attribute returns NULL. And this causes the following code to crash (inside the visit() of the DOMScanner).
>
> if(name.startsWith("xmlns:")) {
> receiver.startPrefixMapping( a.getLocalName(), a.getValue() );
> continue;
> }
>
> java.lang.NullPointerException
> at org.xml.sax.helpers.NamespaceSupport.declarePrefix(Unknown Source)
> at com.sun.msv.verifier.AbstractVerifier.startPrefixMapping(AbstractVerifier.java:79)
> at com.sun.msv.verifier.VerifierFilter.startPrefixMapping(VerifierFilter.java:87)
> at org.iso_relax.verifier.impl.ForkContentHandler.startPrefixMapping(ForkContentHandler.java:65)
> at com.sun.xml.bind.unmarshaller.DOMScanner.visit(DOMScanner.java:153)
> at com.sun.xml.bind.unmarshaller.DOMScanner.parse(DOMScanner.java:72)
> at mm7.impl.runtime.UnmarshallerImpl.unmarshal(UnmarshallerImpl.java:166)
> at Main.parseResponseMessage(oldMain4.java:319)
> at Main.buildRequestMessage(oldMain4.java:178)
> at Main.main(oldMain4.java:70)
>
> Have anyone else seen this also?
> If yes, do you have any idea about how to resolve this?

Many DOM implementations are broken in many ways, and I guess this is
either that, or you didn't turn on the namespace processing.

Could you try the latest msv.jar from http://msv.dev.java.net/ and see
if that fixes the problem? I recall working on a similar issue a few
weeks ago.

regards,
--
Kohsuke Kawaguchi
Sun Microsystems                   kohsuke.kawaguchi_at_sun.com
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe_at_jaxb.dev.java.net
For additional commands, e-mail: users-help_at_jaxb.dev.java.net