Keith-

It was the latter. I was trying to unmarshal a test doc. 

Ok. I created the equivalent instance to marshal. Received the same
error!

Should I log a bug?

Thanks,
Brent

---------------
There was 1 error:
1) testMarshalling(FoodMappingTest)java.lang.NoClassDefFoundError:
Saltyfood (wrong name: SaltyFood)

---------------

   public void testMarshalling(){

        FoodTypes ftypes=new FoodTypes();
        
        Food sweet=new SweetFood();
        sweet.setName("candy");
        
        Food salty=new SaltyFood();
        salty.setName("beef jerky");
        
        Food spicy=new SpicyFood();
        spicy.setName("chili peppers");
        
        List foods = new ArrayList();
        
        foods.add(salty);
        foods.add(sweet);
        foods.add(spicy);
        ftypes.setFoods(foods);
        
        System.out.println(ObjectMarshaller.marshal(ftypes));


-----Original Message-----
From: Keith Visco [mailto:[EMAIL PROTECTED] 
Sent: Wednesday, February 18, 2004 12:13 PM
To: [EMAIL PROTECTED]
Subject: Re: [castor-dev] Error unmarshalling with
autonaming="deriveByClass" and classnames that closely match element
names




Hi Brent,

Is the XML below what Castor produced during marshalling, or is it
something had produced in order to test the unmarshalling? If it's the
later, can you try to do a quick marshal and see what that produces. I'm
wondering if the auto-naming is not properly grabbing the xml name from
the map-to element.

--Keith

> Brent Picasso wrote:
> 
> (sorry if this is a duplicate- the last send apparently failed)
> 
>  Hello-
> 
> I may have found a potential bug. When unmarshalling the test XML doc 
> below, I receive the following error:
> 
> 1) testMapping(FoodMappingTest)java.lang.NoClassDefFoundError:
> Saltyfood (wrong name: SaltyFood)
>         at java.lang.ClassLoader.defineClass0(Native Method)
> ----------------
> 
> Here is the test XML doc and the corresponding mapping file:
> ----------------
> <thefoods>
>     <saltyfood name="beef jerky"/>
>     <sweetfood name="candy"/>
>     <spicyfood name="chili peppers"/>
> </thefoods>
> ----------------
> <mapping>
>     <class name="FoodTypes">
>         <map-to xml="thefoods"/>
>         <field name="foods" type="Food" collection="arraylist">
>             <bind-xml auto-naming="deriveByClass" node="element"/>
>         </field>
>     </class>
> 
>     <class name="SaltyFood">
>         <map-to xml="saltyfood"/>
>         <field name="name" type="java.lang.String">
>             <bind-xml name="name" node="attribute"/>
>         </field>
>     </class>
> 
>     <class name="SpicyFood">
>         <map-to xml="spicyfood"/>
>         <field name="name" type="java.lang.String">
>             <bind-xml name="name" node="attribute"/>
>         </field>
>     </class>
> 
>     <class name="SweetFood">
>         <map-to xml="sweetfood"/>
>         <field name="name" type="java.lang.String">
>             <bind-xml name="name" node="attribute"/>
>         </field>
>     </class>
> 
> </mapping>
> -------------------------------
> 
> I won't include the java classes here, since you can infer there are 3

> concrete classes implementing the 'Food' interface. Notice that the 
> java class names are the same as the element names, except for 
> capitalization.
> 
> *******Note that when I change the element names to something that is 
> spelled different (like sweetfud), it works perfectly.
> 
> Thank you,
> Brent Picasso
> 
>

----------------------------------------------------------- 
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