Return-Path: X-Original-To: apmail-geronimo-user-archive@www.apache.org Delivered-To: apmail-geronimo-user-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 1958066BC for ; Wed, 13 Jul 2011 00:42:32 +0000 (UTC) Received: (qmail 4058 invoked by uid 500); 13 Jul 2011 00:42:31 -0000 Delivered-To: apmail-geronimo-user-archive@geronimo.apache.org Received: (qmail 4006 invoked by uid 500); 13 Jul 2011 00:42:31 -0000 Mailing-List: contact user-help@geronimo.apache.org; run by ezmlm Precedence: bulk list-help: list-unsubscribe: List-Post: Reply-To: user@geronimo.apache.org List-Id: Delivered-To: mailing list user@geronimo.apache.org Received: (qmail 3999 invoked by uid 99); 13 Jul 2011 00:42:30 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 13 Jul 2011 00:42:30 +0000 X-ASF-Spam-Status: No, hits=2.8 required=5.0 tests=FREEMAIL_FROM,HTML_MESSAGE,RCVD_IN_DNSWL_LOW,SPF_PASS,T_TO_NO_BRKTS_FREEMAIL,URI_HEX X-Spam-Check-By: apache.org Received-SPF: pass (athena.apache.org: domain of xhhsld@gmail.com designates 74.125.82.182 as permitted sender) Received: from [74.125.82.182] (HELO mail-wy0-f182.google.com) (74.125.82.182) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 13 Jul 2011 00:42:25 +0000 Received: by wyg24 with SMTP id 24so273015wyg.13 for ; Tue, 12 Jul 2011 17:42:04 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :content-type; bh=mcMK0QEb77fGMptdw0czJNhjn0KdB+rxs5F5QytyRE0=; b=U6SfZcvGICmFgS24Cdt3NnTjFGqTVlAAqTuhDvztsgYz+3esFqFqcjz/EVwvwlNklf ku3Hpj+wC43vdNwKPU5kesOPwVNgapQOOfQsQAONHFc+ASN/2sqbDWnk9EtoIZbsp6FN Mu8E3kBn7gCSFmQPm8j5a0lROJvoxu12fKpGE= MIME-Version: 1.0 Received: by 10.216.197.96 with SMTP id s74mr465356wen.21.1310517723944; Tue, 12 Jul 2011 17:42:03 -0700 (PDT) Received: by 10.216.87.195 with HTTP; Tue, 12 Jul 2011 17:42:03 -0700 (PDT) In-Reply-To: <1310494463246-3163389.post@n3.nabble.com> References: <145934CE-DA83-40EB-9B15-8002862B23A4@gmail.com> <1310418579723-3160476.post@n3.nabble.com> <1310450415638-3161489.post@n3.nabble.com> <1310494463246-3163389.post@n3.nabble.com> Date: Wed, 13 Jul 2011 08:42:03 +0800 Message-ID: Subject: Re: shared lib classloader XStream Jettison issue From: Ivan To: user@geronimo.apache.org Content-Type: multipart/alternative; boundary=0016e6dd863c68557004a7e8aff7 --0016e6dd863c68557004a7e8aff7 Content-Type: text/plain; charset=ISO-8859-1 2011/7/13 ashwin nair > 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.(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 --0016e6dd863c68557004a7e8aff7 Content-Type: text/html; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable

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

System.out.printf("this.classloader =3D %s, this.parentClassloader =3D= %s,
xstream.classloader =3D %s, xstream.jar.location =3D %s \n",
=A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0JSONUtil.class.getClassLoader(),
=A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0JSONUtil.class.getClassLoader().getParent()= ,
=A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0com.thoughtworks.xstream.XStream.class.getC= lassLoader(),
com.thoughtworks.xstream.XStream.class.getProtectionDomain().getCodeSource(= ).getLocation());

=A0 =A0=A0
=A0 =A0Where are the codes above= and JASONUtils from ? =A0I guess that they are in one of the jar files in = the shared lib folder, right ?=A0
=A0 =A0If it does, the result w= ould 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=A0JettisonMappedXmlDriver, it requ= ires to load=A0MappedXMLOutputFactory by the system classloader, then Bang = !
=A0 =A0=A0

and the output is

this.classloader =3D [org.apache.geronimo.kernel.config.MultiParentClassLoa= der
id=3Dorg.apache.geronimo.configs/sharedlib/2.2.1/car], this.parentClassload= er
=3D sun.misc.Launcher$AppClassLoader@7ff27ff2, =A0xstream.classloader =3D sun.misc.Launcher$AppClassLoader@7ff27ff2, xstream.jar.location =3D
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 =3D new XStream(new JettisonMappedXmlDriver());

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


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


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



--
Ivan
--0016e6dd863c68557004a7e8aff7--