I figured out that this exception was due to an internal error occuring
inside
my getContainedComponents() accessor method. It worked fine after fixing
this problem.
Sorry for any inconvenience,
Roshan
Roshan Joyce wrote:
> Hi,
>
> I am new to Castor and have been trying to use it to map a tree of
> java objects into
> an xml document and have run into an issue... I am using version
> 0.9.3.21.
>
> We have an application which has a tree of java objects. Each node of
> the tree is
> an instance of a sub-class of an abstract base class called say,
> Component. This base
> class has a method getContainedComponents() which returns a Vector of
> contained
> objects, each of which is again an instance of a sub-class of
> Component. I get a reference
> to a node in the tree and marshall it using the mapping described below:
>
> <class name="Component">
> <map-to xml="comp"/>
> ... field descriptions ...
> <field name="containedComponents" collection="vector"
> type="Component" get-method="getContainedComponents">
> <bind-xml name="contains" node="element"/>
> </field>
> ... field descriptions ...
> </class>
> <class name="SubComponentA" extends="Component"/>
> <class name="SubComponentB" extends="Component"/>
> ... similar class descriptions for each sub-class of Component ...
>
>
> Is this the correct way to do this? I get the following exception when
> I run the program.
>
> java.lang.IllegalStateException: Field access error:
> containedComponents(Component) access resulted
> in exception: java.lang.reflect.InvocationTargetException at
> org.exolab.castor.mapping.loader.FieldHandlerImpl.getValue(Unknown
> Source) at
> org.exolab.castor.xml.FieldValidator.validate(Unknown Source) at
> org.exolab.castor.xml.util.XMLClassDescriptorImpl.validate(Unknown
> Source) at
> org.exolab.castor.xml.util.XMLClassDescriptorImpl.validate(Unknown
> Source) at
> org.exolab.castor.xml.Validator.validate(Unknown Source) at
> org.exolab.castor.xml.Marshaller.validate(Unknown Source) at
> org.exolab.castor.xml.Marshaller.marshal(Unknown Source)
>
> Thanks in advance for any help,
>
> Roshan
>
> ----------------------------------------------------------- If you
> wish to unsubscribe from this mailing, send mail to
> [EMAIL PROTECTED] with a subject of:
> unsubscribe castor-dev
>
-----------------------------------------------------------
If you wish to unsubscribe from this mailing, send mail to
[EMAIL PROTECTED] with a subject of:
unsubscribe castor-dev