werner, i keep getting MappingException's thrown when attempting to set the mapping file onto the unmarshaller - but again, seems to work fine in a test class...
andrew -----Original Message----- From: Werner Guttmann [mailto:[EMAIL PROTECTED] Sent: 15 December 2004 21:30 To: [EMAIL PROTECTED] Subject: Re: [castor-user] XML - nested mapping issues in webapp vs. jUnit test class Andrew, what problems are you experiencing ? Werner On Wed, 15 Dec 2004 17:54:27 -0000, Andrew Eells wrote: > > >i am attempting nested object mapping with castor xml and have problems when >moving between a junit test class and a webapp i.e. the test class works >whereas the webapp mapping does not. > >i am certain however, that this is NOT a classpath problem, the classpaths >are identical in both environments as my first conclusion was that this >might be the issue... > >i'm not ruling out the possibility that it is a fluke that it works in the >standalone test class because my mapping configuration is not quite correct! > >i can't however find many examples of 3-level nested class mapping and have >read reports of flakiness when performing nested mapping - if anyone else >has had similar problems or has any suggestions then i'd be really grateful >to hear from you! > >code snippets below... many thanks and kind regards, andrew eells > > >Mapping mapping = new Mapping(); >mapping.loadMapping(mappingInputSource); > >Unmarshaller unmarshaller = new Unmarshaller(ReportGroups.class); >unmarshaller.setMapping(mapping); > >ReportGroups reportGroups = (ReportGroups) >unmarshaller.unmarshal(configInputSource); > >data xml file content: > ><report-groups baseDirectory="blah/blah"> > <report-group name="verticals" description="Verticals"> > <report name="report1" description="blah" config="more blah"/> > <report name="report2" description="blah" config="more blah"/> > <report name="report3" description="blah" config="more blah"/> > </report-group> > <report-group name="marketing" description="Marketing"> > <report name="report4" description="blah" config="more blah"/> > </report-group> ></report-groups> > > >mapping file content: > ><mapping> > <class name="com.x.model.ReportGroups"> > <field name="reportGroups" collection="collection" >type="com.x.model.ReportGroup"> > <bind-xml name="report-groups" node="element"/> > </field> > <field name="baseDirectory" type="string"> > <bind-xml name="baseDirectory" node="attribute"/> > </field> > </class> > > <class name="com.x.model.ReportGroup"> > <field name="reports" collection="collection" >type="com.x.model.Report"> > <bind-xml name="report-group" node="element"/> > </field> > <field name="name" type="string"> > <bind-xml name="name" node="attribute"/> > </field> > <field name="description" type="string"> > <bind-xml name="description" node="attribute"/> > </field> > </class> > > <class name="com.x.model.Report"> > <field name="name" type="string"> > <bind-xml name="name" node="attribute"/> > </field> > <field name="description" type="string"> > <bind-xml name="description" node="attribute"/> > </field> > <field name="config" type="string"> > <bind-xml name="config" node="attribute"/> > </field> > </class> ></mapping> > > > > >________________________________________________________________________ >This e-mail has been scanned for all viruses by MessageLabs. > > > >----------------------------------------------------------- >If you wish to unsubscribe from this mailing, send mail to >[EMAIL PROTECTED] with a subject of: > unsubscribe castor-user > ----------------------------------------------------------- If you wish to unsubscribe from this mailing, send mail to [EMAIL PROTECTED] with a subject of: unsubscribe castor-user ________________________________________________________________________ This e-mail has been scanned for all viruses by MessageLabs. ________________________________________________________________________ This e-mail has been scanned for all viruses by MessageLabs. ----------------------------------------------------------- If you wish to unsubscribe from this mailing, send mail to [EMAIL PROTECTED] with a subject of: unsubscribe castor-user
