users@jaxb.java.net

Re: Null pointer exception during unmarshalling

From: <oro7d3_at_netscape.net>
Date: Mon, 23 Feb 2004 19:42:13 -0500

I have more information.

If I unmarshall a SOAP header element, it works with no problem.
But if I ummarshall a SOAP body element, it has this null pointer exception.

The difference between header and body is:
<m:myheader xml:m="url of schema" env:mustUnderstand="1"> text </m:myheader>

<m:mybody xml:m="url of schema" > text </m:mybody>

header has this attribute "env:mustUnderstand" but body does not.

And as I step thrn the code, the "xml:m" attribute of header is an object of AttrNSImpl, but the "xml:m" attribute of body is an object of *AttrImpl" and the getLocalName() of "AttrImpl" always return NULL.


oro7d3_at_netscape.net wrote:

>Kohsuke ,
>
>Thanks for your advice.
>
>I get msv.20040219.zip and replaces all the jars there in my classpath (6 of them in total), but it does not work. I still have the NullPointer exception.
>
>And I get my SOAP message like this:
> SOAPMessage response = con.call(request, endpoint); // con is SOAP connection in SAAJ implemention comes with JWSDP 1.3
>
>And pass one of the SOAP Body Element to the unmarshaller, but I got a Null Pointer exception.
>
>How can I turn on the namespace processing in SAAJ SOAP connection ?
>
>Thanks in advance.
>
>
>
>
>Kohsuke Kawaguchi <Kohsuke.Kawaguchi_at_Sun.COM> wrote:
>
>>
>>> 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
>>
>>
>
>__________________________________________________________________
>Introducing the New Netscape Internet Service.
>Only $9.95 a month -- Sign up today at http://isp.netscape.com/register
>
>Netscape. Just the Net You Need.
>
>---------------------------------------------------------------------
>To unsubscribe, e-mail: users-unsubscribe_at_jaxb.dev.java.net
>For additional commands, e-mail: users-help_at_jaxb.dev.java.net
>
>




__________________________________________________________________
Introducing the New Netscape Internet Service.
Only $9.95 a month -- Sign up today at http://isp.netscape.com/register

Netscape. Just the Net You Need.

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe_at_jaxb.dev.java.net
For additional commands, e-mail: users-help_at_jaxb.dev.java.net