I totally agree with you. We do need a way to say what class loader to use. I was checking with you whether I had missed something. I'll raise a JIRA along with the other JIRA I still need to do when I get a chance!!
Thanks Paul -----Original Message----- From: Werner Guttmann [mailto:[email protected]] Sent: 07 April 2010 13:37 To: [email protected] Cc: Paul French Subject: Re: [castor-user] Setting Class Loader for the marshaller/unmarshaller Hi Paul, On 06.04.2010 15:24, Paul French wrote: > Our application has many third party libraries (including castor) which get > installed in a specific location and are picked up by tomcat by modifying > the common.loader property in catalina.properties. Hence our deployed wars > are relatively small since they contain no jars in WEB-INF/lib Understood. > We generate the descriptors + pojo + cdr files via the SourceGeneratorMain > utility > > org.exolab.castor.builder.SourceGeneratorMain -i XXXX.xsd -package > com.kirona.YYYY -dest src -nomarshall -f -types j2 -generateImportedSchemas > true > > These all get compiled and packaged in the war in WEB-INF/classes along with > the rest of the application. Fine, and that's what it should be. > As a workaround I have done (by extending CasdtorMarshaller from Spring) > > XMLContext context = super.createXMLContext(arg0,arg1); > > context.getInternalContext().setClassLoader(AcceptQuote.class.getClassLoader > ()); > > ...where AcceptQuote.class is a pojo generated by Castor. This works fine. > However context.getInternalContext() has been deprecated and I cannot find > an alternative. Hmm. There's definitely a setClassLoader() method on the Unmarshaller class, but I am not sure that this is exposed in any way. Thinking about this, one could (and should) introduce a setClassLoader() method on XMLContext to allow customization of class loaders. What do you think ? > > Thanks > P > > > -----Original Message----- > From: Werner Guttmann [mailto:[email protected]] > Sent: 06 April 2010 08:43 > To: [email protected] > Cc: Paul French > Subject: Re: [castor-user] Setting Class Loader for the > marshaller/unmarshaller > > Hi Paul, > > it's been 5 years plus that I have seen somebody reporting a problem > like this. Okay, let me ask you a few questions: > > - What tool are you using to generate classes (and descriptors) ? > - Do you compile your descriptor classes ? > - Do you package the compiled descriptors and the generated .castor.cdr > files into your web application ? > > And more importantly, are you .... > > - deploying standard WAR files on Tomcat ? > - having all dependencies (incl. Castor) provided within WEB-INF/lib of > your web application ? > > Regards > Werner > > On 29.03.2010 14:56, Paul French wrote: >> Hello All, >> >> >> >> This seems to be a common problem but I can't seem to find the solution. >> >> >> >> We use castor to marshall and unmarshall using package descriptors/.cdr >> files. >> >> >> >> All is fine in eclipse. When deploying to tomcat due to where certain >> libraries are placed we get classnotfound exceptions. Basically I need to >> tell the marshaller and unmarshaller what class loader to use. How can I > do >> this? >> >> >> >> Thanks >> >> Paul >> >> > > --------------------------------------------------------------------- > To unsubscribe from this list, please visit: > > http://xircles.codehaus.org/manage_email > > > > __________ NOD32 5003 (20100406) Information __________ > > This message was checked by NOD32 antivirus system. > http://www.eset.com > > > > --------------------------------------------------------------------- > To unsubscribe from this list, please visit: > > http://xircles.codehaus.org/manage_email > > __________ NOD32 5007 (20100407) Information __________ This message was checked by NOD32 antivirus system. http://www.eset.com --------------------------------------------------------------------- To unsubscribe from this list, please visit: http://xircles.codehaus.org/manage_email

