Dear All , 

 Hello ! I am a beginner of Castor . I downloaded the
sample from "On JAVA.com" and tried to package it to
my application . 

 The structure is : 

web-inf/com/Person.class
web-inf/com/Addressbook.class
web-inf/com/mapping.xml
web-inf/com/addressbook.xml

 And the mapping.xml is : 

<?xml version="1.0"?>
<!DOCTYPE mapping PUBLIC "-//EXOLAB/Castor Object
Mapping DTD Version 1.0//EN"
"http://Castor.exolab.org/mapping.dtd";>

<mapping>
<description>A mapping file for our Address Book
application</description>

<class name="com.Person">
        <field name="name" type="string">
                <bind-xml name="name" node="attribute" />
        </field>
        <field name="address" type="string" />
        <field name="ssn" type="string" />
        <field name="email" type="string" />
        <field name="homePhone" type="string" />
        <field name="workPhone" type="string" />
</class>

<class name="com.Addressbook">
        <field name="name" type="string">
                <bind-xml name="name" node="attribute" />
        </field>
        <field name="persons" type="com.Person"
collection="collection" />
</class>

</mapping>

 Also , the Java programme (in a Servlet) is : 

URL mappingXml =
getClass().getResource("/com/mapping.xml"); 
URL sourceXml =
getClass().getResource("/com/addressbook.xml"); 

try {
    // -- Load a mapping file
    Mapping mapping = new Mapping();
    mapping.loadMapping(mappingXml);

    Unmarshaller un = new
Unmarshaller(Addressbook.class); 
    un.setMapping( mapping ); ...... 

 However , when I run the programme , there is an
error from Tomcat : 

org.exolab.castor.mapping.MappingException: Nested
error: org.exolab.castor.mapp
ing.MappingException: Could not find the class
com.Person 

 I try to change "com.Person" to "Person" . However ,
the mapping problem still encounted . What futher
configuration should I have ? Thank you ! 


=====
Jonathan 
(Wong Yat Sing) 
Jonathan Studio
M.P (852) - 91235947 
NetMeeting : [EMAIL PROTECTED]
ICQ# 57646152 



__________________________________
Do you Yahoo!?
Yahoo! Small Business $15K Web Design Giveaway 
http://promotions.yahoo.com/design_giveaway/

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

Reply via email to