Hi Anshuma,
Anshuma Ashok Goyal wrote:
> Hi Jorg,
>
>
>
> Thanks for your reply. Format of the CATEGORY_MAP_FILE has not changed.
> After debugging the issue I found that the below code is unable to load my
> class:
>
>
>
> public class CompositeClassLoader extends ClassLoader {
>
> ...
>
>
>
> public Class loadClass(String name) throws ClassNotFoundException {
>
> for (Iterator iterator = classLoaders.iterator();
> iterator.hasNext();) {
>
> ClassLoader classLoader = (ClassLoader) iterator.next();
>
> try {
>
> return classLoader.loadClass(name);
>
> } catch (ClassNotFoundException notFound) {
>
> // ok.. try another one
>
> }
>
> }
>
> // One last try - the context class loader associated with the
> current thread. Often used in j2ee servers.
>
> // Note: The contextClassLoader cannot be added to the
> classLoaders list up front as the thread that constructs
>
> // XStream is potentially different to thread that uses it.
>
> ClassLoader contextClassLoader =
> Thread.currentThread().getContextClassLoader();
>
> if (contextClassLoader != null) {
>
> return contextClassLoader.loadClass(name);
>
> } else {
>
> throw new ClassNotFoundException(name);
>
> }
>
> }
>
>
>
> Any clue?
You may try to use xstream.setClassloader before you call xstream.fromXML.
However, I fear, that then the declared aliases may no longer match. In this
case you have to bite the bullet and you will have to create the XStream
instance every time in the correct thread.
- Jörg
---------------------------------------------------------------------
To unsubscribe from this list, please visit:
http://xircles.codehaus.org/manage_email