Hello,

I am trying to unmarshal the following structure, involving mapping a concrete class 
to a field that defined with an interface.

It's failing with an error:  

testBindingMapping(com.schemalogic.integrator.BindingMappingTest)java.lang.NoClassDefFoundError:
 com/schemalogic/integrator/Bindingconfig (wrong name: 
com/schemalogic/integrator/BindingConfig)

I've looked at the castor mapping documents and implemented the polymorphic behavior 
for auto-naming="deriveByClass". it seems to be ignoring this..

Thanks for any help.
Brent Picasso

My mapping file is:

<mapping>
    <class name="com.schemalogic.integrator.BindingImpl">
        <map-to xml="binding"/>
        <field name="id" type="java.lang.String">
            <bind-xml name="objectid" node="attribute"/>
        </field>
        <field name="name" type="java.lang.String">
            <bind-xml name="name" node="attribute"/>
        </field>
        <field name="description" type="java.lang.String">
            <bind-xml name="description" node="element"/>
        </field>
        <field name="bindingConfig" type="com.schemalogic.integrator.BindingConfig" 
required="true">
            <bind-xml auto-naming="deriveByClass" node="element" 
location="bindingconfig"/>
        </field>
    </class>

    <class name="com.schemalogic.integrator.CustomBindingConfig">
        <map-to xml="custombindingconfig"/>
        <field name="loginId" type="java.lang.String">
            <bind-xml name="loginid" node="attribute"/>
        </field>
        <field name="password" type="java.lang.String">
            <bind-xml name="password" node="attribute"/>
        </field>
        <field name="port" type="java.lang.String">
            <bind-xml name="port" node="attribute"/>
        </field>
        <field name="server" type="java.lang.String">
            <bind-xml name="server" node="attribute"/>
        </field>
    </class>
    
</mapping>

My sample XML to be unmarshalled is:

<binding objectid="1234" name="binding_sample">
    <description>binding sample description</description>
    <bindingconfig>
        <custombindingconfig loginid="uid" password="pwd" port="1234" 
server="custom.kom"/>
    </bindingconfig>
</binding>


Here is the BindingConfig interface:


package com.schemalogic.integrator;

import com.schemalogic.SchemalogicObject;

public interface BindingConfig extends SchemalogicObject{
    
    /** Indicate whether this Binding Configuration is in a valid data state
     * @true if it is in a valid state
     */
    public boolean isValid();
    
}

package com.schemalogic.integrator;

public class CustomBindingConfig extends BaseIntegratorObject implements BindingConfig 
{
    
    private String loginId;
    private String password;
    private String port;
    private String server;
    
    public boolean isValid() {
        return (null!=getLoginId() && null !=getPassword() && null !=getPort() && null 
!=getServer());
    }
    
    public void setLoginId(String newLoginId){
        this.loginId=newLoginId;
    }
    
    public String getLoginId(){
        return this.loginId;
    }
    
    public void setPassword(String newPassword){
        this.password=newPassword;
    }
    
    public String getPassword(){
        return this.password;
    }
    
    public void setPort(String newPort){
        this.port=newPort;
    }
    
    public String getPort(){
        return this.port;
    }
    
    public void setServer(String newServer){
        this.server=newServer;
    }
    
    public String getServer(){
        return this.server;
    }
}

----------------------------------------------------------- 
If you wish to unsubscribe from this mailing, send mail to
[EMAIL PROTECTED] with a subject of:
        unsubscribe castor-dev

Reply via email to