Thanks for your great help. It now works perfectly. One question about the XMLContext object. Do you recommend to only have one instance for your application and load all mappings into that object? Currently, each module loads its own mapping and creates its Marshaller/Unmarshaller. I guess it would be more performant.
-Simon- On Wed, Nov 26, 2008 at 12:48 PM, Joachim Grüneis <[EMAIL PROTECTED]> wrote: > Sorry Simon ;-) > > after I've sent my mail I saw my mistake... > > as for your problem: > the best practice you've used is outdated for 1.3 > you should use something like > > XMLContext ctx = new XMLContext(); > ctx.addMapping(mapping); > > Unmarshaller u = ctx.createUnmarshaller() > u.... > > You can create as many Unmarshaller instances as you like from the > XMLContext - it will reuse the mapping information read. It is no > longer the ClassDescriptorResolver yopu should 'reuse' but the > XMLContext. > > I remeber the documentation you reference to.. but I think it isn't > online any longer... the XMLContext way of doing things is described > in: http://www.castor.org/reference/html-single/index.html#d0e278 > > hth > Joachim > > 2008/11/26 Simon Godard <[EMAIL PROTECTED]>: >> Hi Joachim, >> >> My name is Simon :) >> >> I've attached the code snippet you requested. It fails on the >> following line (line 16 in the file) and then throws a LoadException. >> >> return unmarshaller.unmarshal(inputStream); >> >> Thanks again. >> -Simon- >> >> On Wed, Nov 26, 2008 at 10:45 AM, Joachim Grüneis <[EMAIL PROTECTED]> wrote: >>> Hello Godard, >>> >>> can you please provide the code snipped which terminates with this >>> exception... it must be something with XMLContext, Unmarshaller, ... >>> >>> Regards >>> Joachim >>> >>> 2008/11/26 Simon Godard <[EMAIL PROTECTED]>: >>>> Hi, >>>> >>>> I'm trying to use a ClassDescriptorResolver as describe in Castor's >>>> Best practices, but I've run into problems. >>>> >>>> First, I had to update my version to 1.3rc1 to fix a >>>> NullPointerException. After my update, I'm now getting this >>>> exception: >>>> IllegalStateException: No Introspector defined in properties! thrown >>>> by the ByIntrospection class. I've debugged the code and found out >>>> that the Introspector is not set when using the Best practices >>>> approach. My XMLClassDescriptorResolver _introspector, _classLoader >>>> variables are all null. >>>> >>>> Am I missing something? >>>> I've attached a stackframe and variables view from Eclipse. >>>> >>>> Here is the stacktrace: >>>> Caused by: java.lang.IllegalStateException: No Introspector defined in >>>> properties! >>>> at >>>> org.exolab.castor.xml.util.resolvers.ByIntrospection.internalResolve(ByIntrospection.java:85) >>>> at >>>> org.exolab.castor.xml.util.resolvers.AbstractResolverClassCommand.resolve(AbstractResolverClassCommand.java:55) >>>> at >>>> org.exolab.castor.xml.util.resolvers.CastorXMLStrategy.getDescriptor(CastorXMLStrategy.java:137) >>>> at >>>> org.exolab.castor.xml.util.resolvers.CastorXMLStrategy.resolveClass(CastorXMLStrategy.java:82) >>>> at >>>> org.exolab.castor.xml.util.XMLClassDescriptorResolverImpl.resolve(XMLClassDescriptorResolverImpl.java:289) >>>> at >>>> org.exolab.castor.xml.MarshalFramework.searchInheritance(MarshalFramework.java:506) >>>> at >>>> org.exolab.castor.xml.UnmarshalHandler.startElement(UnmarshalHandler.java:1867) >>>> at >>>> org.exolab.castor.xml.UnmarshalHandler.startElement(UnmarshalHandler.java:1420) >>>> at org.apache.xerces.parsers.AbstractSAXParser.startElement(Unknown >>>> Source) >>>> at >>>> org.apache.xerces.impl.XMLDocumentFragmentScannerImpl.scanStartElement(Unknown >>>> Source) >>>> at >>>> org.apache.xerces.impl.XMLDocumentFragmentScannerImpl$FragmentContentDispatcher.dispatch(Unknown >>>> Source) >>>> at >>>> org.apache.xerces.impl.XMLDocumentFragmentScannerImpl.scanDocument(Unknown >>>> Source) >>>> at org.apache.xerces.parsers.XML11Configuration.parse(Unknown >>>> Source) >>>> at org.apache.xerces.parsers.XML11Configuration.parse(Unknown >>>> Source) >>>> at org.apache.xerces.parsers.XMLParser.parse(Unknown Source) >>>> at org.apache.xerces.parsers.AbstractSAXParser.parse(Unknown Source) >>>> at >>>> org.exolab.castor.xml.Unmarshaller.unmarshal(Unmarshaller.java:748) >>>> at >>>> com.coradiant.configuration.xml.XmlObjectReader.read(XmlObjectReader.java:258) >>>> ... 25 more >>>> >>>> Thanks >>>> Simon Godard >>>> >>>> --------------------------------------------------------------------- >>>> To unsubscribe from this list, please visit: >>>> >>>> http://xircles.codehaus.org/manage_email >>>> >>>> >>> >>> --------------------------------------------------------------------- >>> To unsubscribe from this list, please visit: >>> >>> http://xircles.codehaus.org/manage_email >>> >>> >>> >> >> --------------------------------------------------------------------- >> To unsubscribe from this list, please visit: >> >> http://xircles.codehaus.org/manage_email >> >> > > --------------------------------------------------------------------- > To unsubscribe from this list, please visit: > > http://xircles.codehaus.org/manage_email > > > --------------------------------------------------------------------- To unsubscribe from this list, please visit: http://xircles.codehaus.org/manage_email

