David,
When you create your mapping, pass in the classloader: Mapping m = new Mapping(classloader); Hope that helps. --Keith David Perkowski wrote: > > Hello, > > I'm trying to get my webapp running with Resin-EE and, thanks to the > patches submitted to the list a while back by Ben Galewsky, I seem to > have gotten JDO working (see > http://castor.exolab.org/list-archive/msg08412.html). However, I'm > having trouble with the XML Marshalling part of Castor that I'm using to > feed some XSL transforms. > > Castor JDO is now using the proper classloader, in my case it turns out > to be " > [CompilingClassLoader > src:/home/david/resin-ee-2.1.5/webapps/etp/WEB-INF/classes]" (properly > picking up my persistent classes from my webapp). I learned this from > displaying the classloader that's being used in the method > org.exolab.castor.mapping.loader.Types.typeFromName(), and when I call > the setMapping() method of my new Marshaller, as: > > Document d = XmlUtil.newDocument (); > org.w3c.dom.Node newNode = d.createElement (name); > Marshaller m = new Marshaller (newNode); > m.setMapping (getMapping ()); > > I get an exception: > > org.exolab.castor.mapping.MappingException: Could not find the class > org.etp.ecm.model.DataGatherer > at > >org.exolab.castor.mapping.loader.MappingLoader.createDescriptor(MappingLoader.java:338) > at > org.exolab.castor.xml.XMLMappingLoader.createDescriptor(XMLMappingLoader.java:195) > at > org.exolab.castor.mapping.loader.MappingLoader.loadMapping(MappingLoader.java:230) > at org.exolab.castor.mapping.Mapping.getResolver(Mapping.java:291) > at org.exolab.castor.mapping.Mapping.getResolver(Mapping.java:246) > at org.exolab.castor.xml.Marshaller.setMapping(Marshaller.java:458) > at org.etp.util.CastorUtil.marshalList(CastorUtil.java:76) > ... > > In this case, I notice that the classloader it's trying to use is > "sun.misc.Launcher$AppClassLoader@4b222f" which, to my untrained eye, > does not look like the kind of classloader that might pick up classes > from within my deployed webapp. > > I believe what I need to do is find a way to tell Castor XML what > classloader to use in the same way that I told Castor JDO > (jdo.setClassLoader()), but I can't seem to find anything in the > Javadoc. > > Thanks for any help! > > David > > ----------------------------------------------------------- > If you wish to unsubscribe from this mailing, send mail to > [EMAIL PROTECTED] with a subject of: > unsubscribe castor-dev ----------------------------------------------------------- If you wish to unsubscribe from this mailing, send mail to [EMAIL PROTECTED] with a subject of: unsubscribe castor-dev
