Hi Howard,

Try moving the reference="true" to the <field> element, not the bind-xml
element.

--Keith

howard fraser wrote:
> 
> Hello
> 
> I am marshalling a set of objects to XML using reference and identity
> attributes to allow object instances to be shared.  The resulting XML looks
> correct to me.   I am however running into problems trying to unmarshall
> this XML.
> 
> When I try to unmarshall the XML I get the following exception...
> 
> java.lang.IllegalArgumentException: Type conversion error: could not set
>   value of connection(com.adaptris.core.AdaptrisConnection) with value of
>   type java.lang.String
>         at org.exolab.castor.mapping.loader.FieldHandlerImpl.setValue
>         (FieldHandlerImpl.java:460)
>         ...
> 
> The field connection is a reference to the object that is being shared.
> They type of this reference (com.adaptris.core.AdaptrisConnection) is an
> interface, the mapping file (excerpted below) contains mappings for the
> concrete implementations of this interface (...PtpConnection and
> ...PasConnection).
> 
> Has anyone come across this Exception in this situation before?  Any
> suggestions?
> 
> Mapping file excerpts...
> 
> Mapping for the shared classes (implementations of ..AdaptrisConnection
> interface)...
> 
>   <class name="com.adaptris.core.jms.PtpConnection"
>          auto-complete="true"
>          identity="ident">
> 
>     <field name="ident">
>       <bind-xml name="ident" node="attribute" />
>     </field>
>   </class>
> 
> Mapping for the class which has a reference to the shared class...
> 
>   <class name="com.adaptris.core.jms.PtpProducer"
>          auto-complete="true">
> 
>     <field name="connection"
>            type="com.adaptris.core.AdaptrisConnection">
> 
>       <bind-xml name="connection" reference="true" node="attribute" />
>     </field>
>   </class>
> 
> I can post additional code, marshalled XML, complete mappings, etc. if
> anyone would like.  Any suggestions most appreciated.
> 
> Howard
> 
> -----------------------------------------------------------
> 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

Reply via email to