Barbara, as it seams you need a urgent solution. I would suggest to not use groups then. I don't think that using a mapping will help. One possibility may be to search jira (castor's bugtracking) if someone else reported similar issues. If there is none you should create a new one. We would also appreciate if you could attach a test case that enables us to replay the problem, most offen the only way to fix a issue as you may know yourself.
Regards Ralf Barbara Prechtl schrieb: > Stephen: > > Unfortunately, I still can not see what is wrong, other than stepping to > the line of code and seeing that there is a problem in the castor code > where is dereferencing a null object. I need to get something working > for Monday morning... Unless there is a fix for using groups, my only > solution may be to not use groups in schemas. > > Will a mapping file help with this problem. If so I was also having some > trouble with the mapping tool: > > Mapping class: com.nortel.schema.code.Data.sceStatistics.SceStatistics > Mapping file: > D:\Workspaces\eclipse311\SCESchemaCode/schema/Maps/sceStatisticsMap.xml > org.exolab.castor.mapping.MappingException: Nested error: > java.lang.NullPointerException > java.lang.NullPointerException > at > org.exolab.castor.xml.Marshaller.processAttribute(Marshaller.java:2320) > at > org.exolab.castor.xml.Marshaller.marshal(Marshaller.java:1323) > at > org.exolab.castor.xml.Marshaller.marshal(Marshaller.java:1824) > at org.exolab.castor.xml.Marshaller.marshal(Marshaller.java:821) > at > org.exolab.castor.tools.MappingTool.write(MappingTool.java:478) > at > com.nortel.sce.Map.MappingCreator.createMap(MappingCreator.java:68) > at > com.nortel.sce.Map.CreateClassMaps.createMappingFiles(CreateClassMaps.ja > va:46) > at > com.nortel.sce.Map.CreateClassMaps.main(CreateClassMaps.java:88) > > Barbara > > -----Original Message----- > From: Stephen Bash [mailto:[EMAIL PROTECTED] > Sent: Friday, March 03, 2006 1:08 PM > To: [email protected] > Subject: Re: [castor-user] mapping and binding > > Barbara- > > I came to the same conclusion about the NPE. Because you are using > the SourceGenerator, the descriptors referenced in the code snippet > you quoted are actually Java code that you can open up and look at, > which may or may not be helpful. > > What you're actually interested in is the FieldDescriptor, but you > might be able to find that based on the ClassDescriptor (just follow > the method calls) -- I think Castor names the classes in a fairly > obvious way, so something like NodeTypeClassDescriptor or > DescriptionGroupFieldDescriptor would be a good place to start > looking. If you open the FieldDescriptor (whatever it ends up being > named) and check what its getFieldType method is doing, that might > give some hint to what is happening. Unfortunately we're rapidly > crossing into code I know nothing about... If getFieldType simply > returns null, that comes from the SourceGenerator, and I'm not much > help telling you why it wrote that, but maybe someone else can. > > Let me know what you find. > > Stephen > > > On 3/3/06, Barbara Prechtl <[EMAIL PROTECTED]> wrote: > >>Stephen: >> >>I tried the generateImportedSchema to true and it still did not work. > > I > >>sent you the place in the unmarshaller where it is failing. Please let >>me know if you still want me to put together an example.... cause I >>will, I just have lots of other unrelated stuff in the schema that is >>not necessary to send. >> >>Barbara >> >>-----Original Message----- >>From: Stephen Bash [mailto:[EMAIL PROTECTED] >>Sent: Friday, March 03, 2006 12:39 PM >>To: [email protected] >>Subject: Re: [castor-user] mapping and binding >> >>Barbara- >> >>What version of Castor are you using? I don't know much about the >>SourceGeneration side, but with the correct version of Castor I might >>be able to look at the stack trace and figure out what is happening. >>Next question, can you produce the XML snippet you mentioned from >>marshalling? I'll try to look into it and see if I can glean any >>information from the stack trace. >> >>Stephen >> >> >>On 3/3/06, Barbara Prechtl <[EMAIL PROTECTED]> wrote: >> >>>Stephan: >>> >>>Thanks for your help. I did get the Java objects to marshall without >> >>the >> >>>use of a mapping file. >>> >>>I am now having problems with the unmarshalling of documents that > > use > >>>elements that are of a group type. For instance I have defined in my >>>schema a description group as follows: >>> >>> <xsd:group name="DescriptionGroup"> >>> <xsd:sequence> >>> <xsd:element name="description" >>>type="xsd:string" minOccurs="0" maxOccurs="1"/> >>> </xsd:sequence> >>> </xsd:group> >>> >>>This is used in my NodeType definition: >>> >>><xsd:complexType name="NodeType"> >>> <xsd:sequence> >>> <xsd:group >>>ref="shr:DescriptionGroup"></xsd:group> >>> </xsd:sequence> >>></xsd:complexType> >>> >>> >>>When in my instance document I have the description the > > unmarshalling > >>>throws an exception. >>> >>><node> >>> <description> comment </description> >>></node> >>> >>>When I create the classes with the source generator I use the >> >>following >> >>>flags: >>> >>>generateMappingFiles=true >>>createMarshalMethods=true >>>GenerateImportedSchemas=false >>>Validation=true >>> >>>I am getting an error every time I try to use the description > > element > >>in >> >>>a document. I have noticed that this happens with other group types. >>>Does group unmarshalling work? >>> >>>Thanks, >>>Barbara >>> >>>The error I get is as follows: >>> >>>Error occurred in read. Target Exception is:: >>>org.exolab.castor.xml.MarshalException : null >>>null{file: [not available]; line: 64; column: 18} >>> at >>>org.exolab.castor.xml.Unmarshaller.unmarshal(Unmarshaller.java:669) >>> at >>>org.exolab.castor.xml.Unmarshaller.unmarshal(Unmarshaller.java:563) >>> at >>> >> > com.nortel.sce.xml.utils.XmlToJava.readXMLinstanceToObject(XmlToJava.jav > >>>a:143) >>> at >>>com.nortel.sce.xml.utils.XmlUtils.unmarshallXML(XmlUtils.java:89) >>> at >>>com.nortel.sce.model.ContainerData.read(ContainerData.java:109) >>> at >>>com.nortel.sce.model.ContainerData.<init>(ContainerData.java:52) >>> at >>> >> > com.nortel.sce.model.ApplicationData.getContainerByName(ApplicationData. > >>>java:135) >>> at com.nortel.sce.model.ModelData.main(ModelData.java:273) >>>Caused by: java.lang.NullPointerException >>> at >>> >> > org.exolab.castor.xml.UnmarshalHandler.startElement(UnmarshalHandler.jav > >>>a:1994) >>> at >>> >> > org.exolab.castor.xml.UnmarshalHandler.startElement(UnmarshalHandler.jav > >>>a:1375) >>> at >>> > > org.apache.xerces.parsers.SAXParser.startElement(SAXParser.java:1376) > >>> at >>> >> > org.apache.xerces.validators.common.XMLValidator.callStartElement(XMLVal > >>>idator.java:1214) >>> at >>> >> > org.apache.xerces.framework.XMLDocumentScanner$ContentDispatcher.dispatc > >>>h(XMLDocumentScanner.java:1171) >>> at >>> >> > org.apache.xerces.framework.XMLDocumentScanner.parseSome(XMLDocumentScan > >>>ner.java:381) >>> at >>>org.apache.xerces.framework.XMLParser.parse(XMLParser.java:1081) >>> at >>>org.exolab.castor.xml.Unmarshaller.unmarshal(Unmarshaller.java:655) >>> >>> >>> >>> >>>-----Original Message----- >>>From: Stephen Bash [mailto:[EMAIL PROTECTED] >>>Sent: Friday, March 03, 2006 8:30 AM >>>To: [email protected] >>>Subject: Re: [castor-user] mapping and binding >>> >>>Barbara- >>> >>>I'm not much of an expert on the binding-file side, but I use > > mapping > >>>files all the time. The short answer is no, you don't need both, > > but > >>>yes, they both describe Java object <-> XML relations. >>> >>>In general, I believe, the binding file is used to create Java code >>>(that can then be compiled and used in an application) from an XML >>>Schema. The binding file is most often (only?) used with the Castor >>>SourceGenerator, which creates Java classes that model an XML > > schema, > >>>at which point Castor also creates extra classes (ClassDescriptors > > and > >>>FieldDescriptors) that describe how the Java objects "map" to XML. >>> >>>The mapping file provides an alternate method for the user to > > specify > >>>how Java objects transform into XML content. I tend to think of > > this > >>>as how one starts with a Java object model and then creates the XML >>>structure from it, but it is much more flexible than that. >>> >>>Where the two methods somewhat meet is the >>>ClassDescriptor/FieldDescriptor level. When a user loads a mapping, >>>Castor reads the mapping file and internally creates the appropriate >>>descriptors. If the SourceGenerator was used, the descriptors exist >>>as compiled classes and are instantiated as they are needed (thus > > the > >>>mapping file usually isn't required). >>> >>>That might be more information than you needed, but hopefully it >>>answers the question. Let us know if you have further questions. >>> >>>Stephen >>> >>>On 3/3/06, Barbara Prechtl <[EMAIL PROTECTED]> wrote: >>> >>>> >>>> >>>>To whom it may concern: >>>> >>>> >>>> >>>>I was wondering what the difference between a mapping file and a >>> >>>binding >>> >>>>file is. >>>> >>>> >>>> >>>>Is this correct: >>>> >>>> >>>> >>>>A mapping file is used for writing java objects to xml. >>>> >>>>A binding file is used to read xml to java objects. >>>> >>>> >>>> >>>>They both seem to describe the element to object relation. Are > > both > >>>needed? >>> >>>> >>>> >>>>Thanks, >>>> >>>>Barbara >>> >>>------------------------------------------------- >>>If you wish to unsubscribe from this list, please >>>send an empty message to the following address: >>> >>>[EMAIL PROTECTED] >>>------------------------------------------------- >>> >>> >> >>------------------------------------------------- >>If you wish to unsubscribe from this list, please >>send an empty message to the following address: >> >>[EMAIL PROTECTED] >>------------------------------------------------- >> >> > > > ------------------------------------------------- > If you wish to unsubscribe from this list, please > send an empty message to the following address: > > [EMAIL PROTECTED] > ------------------------------------------------- -- Syscon Ingenieurbüro für Meß- und Datentechnik GmbH Ralf Joachim Raiffeisenstraße 11 D-72127 Kusterdingen Germany Tel. +49 7071 3690 52 Mobil: +49 173 9630135 Fax +49 7071 3690 98 Email: [EMAIL PROTECTED] Web: www.syscon-world.de ------------------------------------------------- If you wish to unsubscribe from this list, please send an empty message to the following address: [EMAIL PROTECTED] -------------------------------------------------

