All,

I posted the following on axis-dev and am reposting it here in case it might be helpful to someone.

Meka Egwuekwe



-------- Original Message --------
Subject: Misleading error message(s) (for example: "no deserializer defined for array type")
Date: Fri, 10 Jan 2003 11:43:06 -0600
From: Nnaemeka Egwuekwe <[EMAIL PROTECTED]>
Organization: Geobot, Inc.
To: [EMAIL PROTECTED]


I am posting this here because this arguably more of a "feature" than a 
"bug":

Using Axis release 1.0, I have been writing some code to generically 
connect to various web services based on configuration options, and then 
using wsdl2java to generate and compile stub classes and reflection to 
invoke the appropriate method on the appropriate stub class.  For return 
types that are arrays of beans, I continually ran into a SAXException 
that stated that I had "no deserializer defined for array type".  

For three days various things I tried failed, until I used the stack 
trace to peer into the Axis source and find the line in 
ArrayDeserializer.java (line 249) where the exception was being thrown. 
 I noticed that the SAXException is being thrown inside of a 
catch(Exception e) clause, but none of the original exception's text was 
kept or reported to the user.  

I modified the source to attach the original exception to the new 
SAXException and discovered that I actually had a ClassNotFoundException 
and that my error had nothing to do with defining a deserializer, but 
instead was quite simple: updating my global classpath to include my 
generated classes!  However, because the original exception was 
suppressed, it was not immediately obvious.

Because others have also run into the dreaded "no deserializer defined 
for array type" problem, I am suggesting that line 249 in 
ArrayDeserializer.java be changed from this:

                    throw new SAXException(
                       Messages.getMessage("noComponent00", 
                                            "" + defaultItemType));

to this:

                    throw new SAXException(
                       Messages.getMessage("noComponent00", 
                                            "" + defaultItemType), e);

where the original exception is attached to the new SAXException.  As 
well, there may be other areas also where original exceptions are being 
suppressed and may need to be propagated and I suggest the same remedy.

Thank you very much,
Meka Egwuekwe



-----Original Message-----
From: McCaslin Orion [mailto:[EMAIL PROTECTED]]
Sent: Wednesday, January 08, 2003 7:51 PM
To: [EMAIL PROTECTED]
Subject: No deserializer defined for array type ?


Hi,

I am not having success getting an array of complex objects deserialized in
a simple test client.

Has anybody figured out how to solve this error?

org.xml.sax.SAXException: No deserializer defined for array type
{http://object.myObject}MyObject at
org.apache.axis.encoding.ser.ArrayDeserializer.onStartElement(ArrayDeseriali
zer.java:257)


The Service function:
public MyObject[] getMyObjects() {
MyObject[] myObjArray = new MyObject[3];
myObjArray[0]= new MyObject();
myObjArray[1]= new MyObject();
myObjArray[2]= new MyObject();
return(myObjArray);
}

I've seen a few of these error postings w/o answers.

In another posting, a workaround was mentioned...
----------------------------------------------------
Define a class which holds your array, and make the
new class a bean. Something like this

class Folders {
Folder[] folders;
getter/setter functions
-----------------------------------------------------
Is this really the only way?

Many thanks,
Orion

Reply via email to