Hi,

thats strange even without a mapping file such a unmarshalling scenario works 
for me. Could you provide a little 
bit more detail? As far as I know reflection is not involved if you use a 
mapping-file (assuming you not specified the 
autocomplete feature in the mapping-file). Anyway could you also check your not 
using one of the static unmarshalling 
methods? This is a common mistake as your mapping-file is ignored then in 
unmarshalling.

Regards, 

Martin

-----Ursprüngliche Nachricht-----
Von: avner21J [mailto:[email protected]] 
Gesendet: Montag, 21. Juni 2010 07:20
An: [email protected]
Betreff: [castor-user] org.exolab.castor.xml.MarshalException:Unable to 
instantiate java.util.List


Hi,

I am using castor (ver 1.3.1) to unmarshal an xml into a java object.
This object has member variables as collections (List).

Even though in the mapping file I used collections attribute of field tag
and has set it to arraylist, it is still throwing this exception.

After doing a bit of research on this,I found that since UnmarshalHandler
uses reflection to create object from xml, it is trying to invoke
java.util.List.newInstance() which might be the root of the problem.

The class which I am trying to unmarshal is an already existing class and I
cannot change the type of the member variables to ArrayList from List.

Exception Trace is below:

Caused by: java.lang.InstantiationException: java.util.List() method not
found
at 
org.exolab.castor.xml.UnmarshalHandler.createInstance(UnmarshalHandler.java:2584)
at 
org.exolab.castor.xml.UnmarshalHandler.startElement(UnmarshalHandler.java:2348)
at 
org.exolab.castor.xml.UnmarshalHandler.startElement(UnmarshalHandler.java:1436)
at org.apache.xerces.parsers.AbstractSAXParser.startElement(Unknown 
Source)
at 
org.apache.xerces.impl.XMLDocumentFragmentScannerImpl.scanStartElement(Unknown
Source)

I am stuck with this. Please help me resolve this.
-- 
View this message in context: 
http://old.nabble.com/org.exolab.castor.xml.MarshalException%3AUnable-to-instantiate-java.util.List-tp28945150p28945150.html
Sent from the Castor - User mailing list archive at Nabble.com.


---------------------------------------------------------------------
To unsubscribe from this list, please visit:

    http://xircles.codehaus.org/manage_email



---------------------------------------------------------------------
To unsubscribe from this list, please visit:

    http://xircles.codehaus.org/manage_email


Reply via email to