2011/7/13 ashwin nair <matrixnair@gmail.com>
I ran the following from a remote debug session

System.out.printf("this.classloader = %s, this.parentClassloader = %s,
xstream.classloader = %s, xstream.jar.location = %s \n",
               JSONUtil.class.getClassLoader(),
               JSONUtil.class.getClassLoader().getParent(),
               com.thoughtworks.xstream.XStream.class.getClassLoader(),
com.thoughtworks.xstream.XStream.class.getProtectionDomain().getCodeSource().getLocation());

    
   Where are the codes above and JASONUtils from ?  I guess that they are in one of the jar files in the shared lib folder, right ? 
   If it does, the result would make sense to me. As no filter rules is configured on the shared lib, so it could load the xstream class from its parent, system classloader. And, it seems that in the initialization of JettisonMappedXmlDriver, it requires to load MappedXMLOutputFactory by the system classloader, then Bang !
    

and the output is

this.classloader = [org.apache.geronimo.kernel.config.MultiParentClassLoader
id=org.apache.geronimo.configs/sharedlib/2.2.1/car], this.parentClassloader
= sun.misc.Launcher$AppClassLoader@7ff27ff2,  xstream.classloader =
sun.misc.Launcher$AppClassLoader@7ff27ff2, xstream.jar.location =
file:/ebay/v3app/CORE/lib/xstream-1.3.jar


/ebay/v3app/CORE is the GERONIMO_HOME

JSONUtil is the utility class where we have the following line

XStream xstream = new XStream(new JettisonMappedXmlDriver());

that fails with exception
java.lang.NoClassDefFoundError:
org/codehaus/jettison/mapped/MappedXMLOutputFactory
       at
com.thoughtworks.xstream.io.json.JettisonMappedXmlDriver.<init>(JettisonMappedXmlDriver.java:46)
       at com.ebay.eskernel.util.JSONUtil.ObjToJSON(JSONUtil.java:132)


I checked the config.ser, it has the filter definitions in it, I must have
been sleeping when I first checked it.


--
View this message in context: http://apache-geronimo.328035.n3.nabble.com/shared-lib-classloader-XStream-Jettison-issue-tp3150142p3163389.html
Sent from the Users mailing list archive at Nabble.com.



--
Ivan