28 04, 2005

castor problem with mapping.xml

> -----Original Message-----
> From: Marco Mistroni [mailto:[EMAIL PROTECTED]]
> Sent: 7 June 2004 14:48
> To: [EMAIL PROTECTED]
> Subject: [castor-user] problem with mapping.xml
>
>
>
> Hi all
>       I m using Castor XML2j in a J2EE application..
>
> I am experiencing problems with the Mapping.xml file, in the sense
> That it tells me 'org.exolab.castor.mapping.MappingException: Nested
> error: org.exolab.castor.mapping.MappingException: Could not find the
> class com.myapp.Request
>
> But that class is in the same JAR as the mapping.xml..
>
> And, if I run my application NOT in an application server
> Everything works just fine....
>
> Anyone has any idea on what could be wrong?
>
> Regards
>       marco

Re: [castor-user] problem with mapping.xml

Claude Vedovini
Mon, 07 Jun 2004 06:25:59 -0700

Title: RE: [castor-user] problem with mapping.xml

Hi Marco,

It might be because the castor classes are in a parent classloader to the one where your business classes are loaded from.

Make sure you construct your Mapping object with the classloader that contains your classes.

Something like:
mapping = new Mapping(getClass().getClassLoader());
mapping.loadMapping(getClass().getResource("mapping.xml"));

Hope that helps :-)
Claude



×îлظ´

ÈÕ£¡

×÷Õß ÈÕ 04 11 2005, 20:46