You are viewing a plain text version of this content. The canonical link for it is here.
Posted to java-user@axis.apache.org by Ramesh Vijayaraghavan <sc...@hotmail.com> on 2005/04/13 03:46:36 UTC

NULL Pointer exception in BeanDeserializer


I am getting this exception when use an apache axis java client to consume a 
.NET webservice.
. The version of axis is 1.2RC3. Can somebody point out what the problem is
I am passing an input parameter with a forward slash like 
<COMPANYNAME>/<USERNAME>.
This is when I see this exception.


C:\downloads\test_ult_wrapped>java TestClient
- Unable to find required classes (javax.activation.DataHandler and 
javax.mail.i
nternet.MimeMultipart). Attachment support is disabled.
- Exception:
java.lang.NullPointerException
       at 
org.apache.axis.encoding.ser.BeanDeserializer.onStartChild(BeanDeseri
alizer.java:282)
       at 
org.apache.axis.encoding.DeserializationContext.startElement(Deserial
izationContext.java:1035)
       at 
org.apache.axis.message.SAX2EventRecorder.replay(SAX2EventRecorder.ja
va:165)
       at 
org.apache.axis.message.MessageElement.publishToHandler(MessageElemen
t.java:1140)
       at 
org.apache.axis.message.RPCElement.deserialize(RPCElement.java:238)
       at org.apache.axis.message.RPCElement.getParams(RPCElement.java:386)
       at org.apache.axis.client.Call.invoke(Call.java:2437)
       at org.apache.axis.client.Call.invoke(Call.java:2336)
       at org.apache.axis.client.Call.invoke(Call.java:1793)



Re: NULL Pointer exception in BeanDeserializer

Posted by Ramesh Vijayaraghavan <sc...@hotmail.com>.
Thanks Peter, Line 282 falls somewhere in the comments section in the 
source. Can somebody provide some information if this issue will be fixed in 
the stable release. Any workarounds are welcome.

Thanks,

        // Register value target
        if (propDesc.isWriteable()) {
            // If this is an indexed property, and the deserializer we found
            // was NOT the ArrayDeserializer, this is a non-SOAP array:
            // <bean>
            //   <field>value1</field>
            //   <field>value2</field>
            // ...
<Line 282>           // In this case, we want to use the collectionIndex and 
make sure
            // the deserialized value for the child element goes into the
            // right place in the collection.
            if (propDesc.isIndexed() && (
                    !(dSer instanceof ArrayDeserializer) ||
                    propDesc.getType().isArray())) {
                    collectionIndex++;
                    dSer.registerValueTarget(new BeanPropertyTarget(value,
                                                    propDesc, 
collectionIndex));
            } else {
                // If we're here, the element maps to a single field value,
                // whether that be a "basic" type or an array, so use the
                // normal (non-indexed) BeanPropertyTarget form.
                collectionIndex = -1;
                dSer.registerValueTarget(new BeanPropertyTarget(value,
                                                                propDesc));
            }
        }

        // Let the framework know that we need this deserializer to complete
        // for the bean to complete.
        addChildDeserializer(dSer);



Re: NULL Pointer exception in BeanDeserializer

Posted by Anne Thomas Manes <at...@gmail.com>.
I'm a little leary of this definition in the schema:

<s:complexType name="ArrayOfAnyType">
  <s:sequence>
    <s:element minOccurs="0" maxOccurs="unbounded" name="anyType"
         nillable="true" />
  </s:sequence>
</s:complexType>

This defines an *element* named "anyType" (rather than a *type* named
"anyType"), which I suspect could cause a lot of confusion.

I would suggest changing it to 

<s:complexType name="ArrayOfAnyType">
  <s:sequence>
     <s:element minOccurs="0" maxOccurs="unbounded" name="item" type="anyType" 
         nillable="true" />
  </s:sequence>
</s:complexType>

Anne

On 4/13/05, Ramesh Vijayaraghavan <sc...@hotmail.com> wrote:
> 
> Also, please note that his looks like an array within an array, Array of
> variables enclosing an Array of anytype. Is this WSDL definition corrrect?
> Thanks,
> 
>

Re: NULL Pointer exception in BeanDeserializer

Posted by Ramesh Vijayaraghavan <sc...@hotmail.com>.
Also, please note that his looks like an array within an array, Array of 
variables enclosing an Array of anytype. Is this WSDL definition corrrect?
Thanks,



Re: NULL Pointer exception in BeanDeserializer

Posted by Ramesh Vijayaraghavan <sc...@hotmail.com>.
This is the WSDL file of the .NET service provider that I am using. I am 
wring an Apache Axis Java Client to access a .NET web service provider. I am 
trying to invoke the GetLaunchInformation web service and I am getting a 
NULL pointer exception in the BeanDeserializer. see my earlier emails. The 
input is a user name( in the following format DOMAIN/USERNAME)

And the interesting part is that  output is an array of anytype and an error 
string. The internet is full of information about the problems with array of 
anytypes as output.

Also I generated the java stub files using WSDLtoJava and the array of 
anytype uses BeanSerializer and Bean Deserailizer as its serializer and 
deserializer. Shouldn't it be using Array Serializer and Array Deserializaer 
instead? These files were autogenerated. so won't WSDLto java know what type 
of serializer to use.

Are there any caveats for the Array of Anytpe for .NET interop with Axis 
java client.

Any help is appreciated.




<?xml version="1.0" encoding="utf-8" ?>
- <wsdl:definitions xmlns:http="http://schemas.xmlsoap.org/wsdl/http/" 
xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" 
xmlns:s="http://www.w3.org/2001/XMLSchema" 
xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/" 
xmlns:tns="http://www.xxx.com" 
xmlns:tm="http://microsoft.com/wsdl/mime/textMatching/" 
xmlns:mime="http://schemas.xmlsoap.org/wsdl/mime/" 
targetNamespace="http://www.xxx.com" 
xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/">
- <wsdl:types>
- <s:schema elementFormDefault="qualified" 
targetNamespace="http://www.xxx.com">
- <s:element name="GetLaunchInformation">
- <s:complexType>
- <s:sequence>
  <s:element minOccurs="0" maxOccurs="1" name="strUserName" type="s:string" 
/>
  </s:sequence>
  </s:complexType>
  </s:element>
- <s:element name="GetLaunchInformationResponse">
- <s:complexType>
- <s:sequence>
  <s:element minOccurs="1" maxOccurs="1" name="GetLaunchInformationResult" 
type="s:boolean" />
  <s:element minOccurs="0" maxOccurs="1" name="varList" 
type="tns:ArrayOfVariable" />
  <s:element minOccurs="0" maxOccurs="1" name="strError" type="s:string" />
  </s:sequence>
  </s:complexType>
  </s:element>
- <s:complexType name="ArrayOfVariable">
- <s:sequence>
  <s:element minOccurs="0" maxOccurs="unbounded" name="Variable" 
nillable="true" type="tns:Variable" />
  </s:sequence>
  </s:complexType>
- <s:complexType name="Variable">
- <s:complexContent mixed="false">
- <s:extension base="tns:MarshalByRefObject">
- <s:sequence>
  <s:element minOccurs="0" maxOccurs="1" name="strVariableName" 
type="s:string" />
  <s:element minOccurs="0" maxOccurs="1" name="objVariableValue" 
type="tns:ArrayOfAnyType" />
  </s:sequence>
  </s:extension>
  </s:complexContent>
  </s:complexType>
  <s:complexType name="MarshalByRefObject" abstract="true" />
- <s:complexType name="ArrayOfAnyType">
- <s:sequence>
  <s:element minOccurs="0" maxOccurs="unbounded" name="anyType" 
nillable="true" />
  </s:sequence>
  </s:complexType>


Thanks,
Ramesh



Re: NULL Pointer exception in BeanDeserializer

Posted by Peter Smith <pe...@fast.fujitsu.com.au>.
A bug detection tool I ran recently identified a possible null pointer 
dereference in this very method. (line numbers don't match exactly but I 
was using 1.2beta3 source code).

The problem detected by the tool related to an unguarded dereference of 
the 'dSer' local var:

                    dSer.registerValueTarget(new BeanPropertyTarget(value,
                            propDesc, collectionIndex))

Unfortunately, I am not at all familiar with the Axis code, nor how your 
scenario has caused this problem, but at least now that there is 
apparently a *real* user problem I hope my earlier bug report may be 
taken a bit more seriously ;-)

See http://issues.apache.org/jira/browse/AXIS-1924

Peter


Ramesh Vijayaraghavan wrote:

>
>
> I am getting this exception when use an apache axis java client to 
> consume a .NET webservice.
> . The version of axis is 1.2RC3. Can somebody point out what the 
> problem is
> I am passing an input parameter with a forward slash like 
> <COMPANYNAME>/<USERNAME>.
> This is when I see this exception.
>
>
> C:\downloads\test_ult_wrapped>java TestClient
> - Unable to find required classes (javax.activation.DataHandler and 
> javax.mail.i
> nternet.MimeMultipart). Attachment support is disabled.
> - Exception:
> java.lang.NullPointerException
>       at 
> org.apache.axis.encoding.ser.BeanDeserializer.onStartChild(BeanDeseri
> alizer.java:282)
>       at 
> org.apache.axis.encoding.DeserializationContext.startElement(Deserial
> izationContext.java:1035)
>       at 
> org.apache.axis.message.SAX2EventRecorder.replay(SAX2EventRecorder.ja
> va:165)
>       at 
> org.apache.axis.message.MessageElement.publishToHandler(MessageElemen
> t.java:1140)
>       at 
> org.apache.axis.message.RPCElement.deserialize(RPCElement.java:238)
>       at 
> org.apache.axis.message.RPCElement.getParams(RPCElement.java:386)
>       at org.apache.axis.client.Call.invoke(Call.java:2437)
>       at org.apache.axis.client.Call.invoke(Call.java:2336)
>       at org.apache.axis.client.Call.invoke(Call.java:1793)
>

This is an email from Fujitsu Australia Software Technology Pty Ltd, ABN 27 003 693 481. It is confidential to the ordinary user of the email address to which it was addressed and may contain copyright and/or legally privileged information. No one else may read, print, store, copy or forward all or any of it or its attachments. If you receive this email in error, please return to sender. Thank you.

If you do not wish to receive commercial email messages from Fujitsu Australia Software Technology Pty Ltd, please email unsubscribe@fast.fujitsu.com.au