In the Main class where I initialized the Unmarshaller, I had Unmarshaller unmarshaller = new Unmarshaller(com.gandeev.base.ServiceProps.class);
instead of Unmarshaller unmarshaller = new Unmarshaller(com.gandeev.base.GandeevProps.class); No wonder, it was trying to looking for fied descriptor of "gservice" in Class descriptor of ServiceProps. Hope that helps. -Suresh Kevin Read wrote: >Hi Suresh > >What was the issue, I'm looking for a solution to the same issue. > >New to Java - it doesn't help ;-) > >Kevin > >-----Original Message----- >From: Avadhanula Suresh [mailto:[EMAIL PROTECTED]] >Sent: Wednesday, 12 December 2001 3:02 PM >To: [EMAIL PROTECTED] >Subject: Re: [castor-dev] Exception when Unmarshalling to an Object >containg reference to another object. > > >I found out the problem. >Sorry my mistake. >Thanks >Suresh > >Suresh Avadhanula wrote: > >>Hi, >>I am new to Castor. I did go through the documents and >>searched the archives. I have spent some time looking >>into it and am at a point where I appreciate any help >>or input. >> >>I am unmarshalling the xml file. (By the way, >>Marshalling works as I was able to generate the below >>file by Marshalling.) >> >><gdprops> >> <gservice ServiceName="service.logging" >>ClassName="com.gandeev.log.LogService"/> >> <xservice ServiceName="service.datastore" >>ClassName="com.gandeev.dataStore.DataStoreService"/> >></gdprops> >> >>Here is my mapping file. >> >><mapping> >><!-- Mapping for Gandeev Properties --> >><class name="com.gandeev.base.ServiceProps"> >> <map-to xml="gservice"/> >> <description>Gandeev Services</description> >> <field name="serviceName" >>type="java.lang.String" >> get-method="getServiceName" >> set-method="setServiceName"> >> <bind-xml name="ServiceName" >>node="attribute"/> >> </field> >> <field name="className" >>type="java.lang.String" >> get-method="getClassName" >> set-method="setClassName"> >> <bind-xml name="ClassName" >>node="attribute"/> >> </field> >> </class> >> <class name="com.gandeev.base.GandeevProps"> >> <description>Gandeev Services >>Properties</description> >> <map-to xml="gdprops"/> >> <field name="services" >>type="com.gandeev.base.ServiceProps" >>collection="vector" >> get-method="getServices" >> set-method="setServices"> >> <bind-xml name="gservice" /> >> </field> >> </class> >></mapping> >> >>I am getting the following exception. >> >>org.xml.sax.SAXException: unable to find >>FieldDescriptor for 'gservice' in ClassDescriptor of >>gservice >> at >>org.exolab.castor.xml.UnmarshalHandler.startElement(UnmarshalHandler.ja >> >va:815) > >> at >>org.apache.xerces.parsers.SAXParser.startElement(SAXParser.java:1335) >> at >>org.apache.xerces.validators.common.XMLValidator.callStartElement(XMLVa >> >lidator.java:823) > >> at >>org.apache.xerces.framework.XMLDocumentScanner.scanElement(XMLDocumentS >> >canner.java:1852) > >> at >>org.apache.xerces.framework.XMLDocumentScanner$ContentDispatcher.dispat >> >ch(XMLDocumentScanner.java:1233) > >> at >>org.apache.xerces.framework.XMLDocumentScanner.parseSome(XMLDocumentSca >> >nner.java:380) > >> at >>org.apache.xerces.framework.XMLParser.parse(XMLParser.java:900) >> at >>org.exolab.castor.xml.Unmarshaller.unmarshal(Unmarshaller.java:338) >> at >>org.exolab.castor.xml.Unmarshaller.unmarshal(Unmarshaller.java:270) >> at com.gandeev.base.Main.<init>(Main.java:46) >> at com.gandeev.base.Main.main(Main.java:91) >> >> >>Here is what I am problem with. >>In the mapping file, I did specify that >>Object GandeevProps contains only one field, which is >>a vector, of type ServiceProps specified by the name >>'gservice'. >> >>During Unmarshalling, I would assume, due the >>recursive nature, gdprops is unmarshalled first. >>gservices is encountered, so it creates an object of >>type ServiceProps and sets the correspoind fields. >> >>Why is that I get and exception >>Unable to find FieldDescriptor 'gservice' in >>ClassDescriptor of 'gservice'. >> >>I still get the exception if I remove >><map-to xml="gservice"> from ServiceProps mapping tag >>as specified in the documentation that only root class >>should have map-to element. >> >>The exception I get is >> >>Unable to find FieldDescriptor 'gservice' in >>ClassDescriptor Sercvice-props >> >>Any help is appreciated. >> >>-Suresh >> >> >> >> >> >> >>__________________________________________________ >>Do You Yahoo!? >>Check out Yahoo! Shopping and Yahoo! Auctions for all of >>your unique holiday gifts! Buy at http://shopping.yahoo.com >>or bid at http://auctions.yahoo.com >> >>----------------------------------------------------------- >>If you wish to unsubscribe from this mailing, send mail to >>[EMAIL PROTECTED] with a subject of: >> unsubscribe castor-dev >> > > > >_________________________________________________________ >Do You Yahoo!? >Get your free @yahoo.com address at http://mail.yahoo.com > >----------------------------------------------------------- >If you wish to unsubscribe from this mailing, send mail to >[EMAIL PROTECTED] with a subject of: > unsubscribe castor-dev > > > > _________________________________________________________ Do You Yahoo!? Get your free @yahoo.com address at http://mail.yahoo.com ----------------------------------------------------------- If you wish to unsubscribe from this mailing, send mail to [EMAIL PROTECTED] with a subject of: unsubscribe castor-dev
