From users-return-230572-apmail-tomcat-users-archive=tomcat.apache.org@tomcat.apache.org Thu Dec 22 15:20:30 2011 Return-Path: X-Original-To: apmail-tomcat-users-archive@www.apache.org Delivered-To: apmail-tomcat-users-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 7F7619343 for ; Thu, 22 Dec 2011 15:20:30 +0000 (UTC) Received: (qmail 35202 invoked by uid 500); 22 Dec 2011 15:20:26 -0000 Delivered-To: apmail-tomcat-users-archive@tomcat.apache.org Received: (qmail 35144 invoked by uid 500); 22 Dec 2011 15:20:26 -0000 Mailing-List: contact users-help@tomcat.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: "Tomcat Users List" Delivered-To: mailing list users@tomcat.apache.org Received: (qmail 35131 invoked by uid 99); 22 Dec 2011 15:20:26 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 22 Dec 2011 15:20:26 +0000 X-ASF-Spam-Status: No, hits=-0.0 required=5.0 tests=SPF_PASS X-Spam-Check-By: apache.org Received-SPF: pass (athena.apache.org: domain of pid@pidster.com designates 74.125.82.43 as permitted sender) Received: from [74.125.82.43] (HELO mail-ww0-f43.google.com) (74.125.82.43) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 22 Dec 2011 15:20:19 +0000 Received: by wgbds11 with SMTP id ds11so31355195wgb.0 for ; Thu, 22 Dec 2011 07:19:58 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=pidster.com; s=google; h=message-id:date:from:organization:user-agent:mime-version:to :subject:references:in-reply-to:x-enigmail-version:openpgp :content-type; bh=5l26abLGG9wThzlaJ91MT0XqjlnJI5sI/DtPhCPx1Ns=; b=XGKosQtG3HxjELr7q8WwVbCjAAmT/X2FAqIngS8mLfSjiXt+XcmkdXbyN1weCDY9wX yfkxwtYddjwijjIMqHBa2Lkush1l758bnPiX5d9LQGyDD8alYYJMegx3iRYdQBX3dRto gzH6hFvpJxn/6qMGoZu+1+EK0ePH9qpcUYed0= Received: by 10.227.60.14 with SMTP id n14mr10884092wbh.5.1324567198642; Thu, 22 Dec 2011 07:19:58 -0800 (PST) Received: from Asura.local (host81-130-3-46.in-addr.btopenworld.com. [81.130.3.46]) by mx.google.com with ESMTPS id en20sm23321667wid.10.2011.12.22.07.19.56 (version=SSLv3 cipher=OTHER); Thu, 22 Dec 2011 07:19:57 -0800 (PST) Message-ID: <4EF34A9A.6030500@pidster.com> Date: Thu, 22 Dec 2011 15:19:54 +0000 From: Pid Organization: Pidster Inc User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.7; rv:8.0) Gecko/20111105 Thunderbird/8.0 MIME-Version: 1.0 To: Tomcat Users List Subject: Re: MBean InitialContext() Tomcat query- pls help References: In-Reply-To: X-Enigmail-Version: 1.3.4 OpenPGP: id=62590808 Content-Type: multipart/signed; micalg=pgp-sha512; protocol="application/pgp-signature"; boundary="------------enigD3929468B563F3580670B2A1" --------------enigD3929468B563F3580670B2A1 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable On 22/12/2011 10:34, Konstantin Kolinko wrote: > 2011/12/20 S B : >> Hi, >> >> I created and deployed an MBean in my tomcat. It uses datasource to co= nnect >> to DB. >> >> My questions is: >> >> When I create InitialContext() inside MBean's constructor and pass the= >> envContext to DBManager class to lookup datasource it works fine. Howe= ver >> when I create InitialContext() in DBManager class, it fails. >=20 > IIRC what InitialContext() sees as its environment highly depends on > what classloader is active. That is TCCL =3D > Thread.getContextClassLoader(). >=20 > So while it is run from within web application your TCCL =3D your > webapp's classloader. >=20 > When it is invoked from jconsole it might be a separate Thread, not > related to your web application. Like he ^^^ said. :) p --=20 [key:62590808] --------------enigD3929468B563F3580670B2A1 Content-Type: application/pgp-signature; name="signature.asc" Content-Description: OpenPGP digital signature Content-Disposition: attachment; filename="signature.asc" -----BEGIN PGP SIGNATURE----- Version: GnuPG/MacGPG2 v2.0.17 (Darwin) Comment: GPGTools - http://gpgtools.org Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/ iQIcBAEBCgAGBQJO80qbAAoJEGoM2OGpOvr9JDEP/294AOn5sVh8MlfXHxRCM5IM ixCOwtJqmx7rTAqqhV8EIEx2SrtWR6louSMmp2Tf6EC+EfhMM5mVV9gVLAevGUIz hrQYdzDMd3l0FVS7lWVjeb0ML7hieSw7zS98bYhN207sybMGH8gK083QnNLHyfUS YzaPFp2ixNx3OE1L52/8fQV6ocQ/HqVVZgo9HcGlBPdx7YGMNhLWMeLOLjd++4dZ R0Rns/f5M8lULRku9mpmafd83YG70rwOFpSrQCeJTNDT4rdmeCn0RCWz0AgDZiW3 96m3LHbX+IG6e/dtGErVoohfa1btW6Oyg7CvL+UXbFfPAVAGK/pXfcj8xgDR14mP 8VuiLgdS/wLyX8g+CTZeDweeVC4BUsRx7Yw2O4m/tR9NO/CK58Tl3jgiJ8pwGJ8J l6YQ8b9Ef6CdsionSLx4/2ooAEIAaLTUDodaHrsTSsgzBsc9s4i3yJr+yYvBEP1F dqJ23WZOlFfg7J6yVNA2GBXyCQfR8rI8oC9FpJwwUMkEl9jMZotjaPETNzK3OyYk YXA7qAHU0ZeWbCfzxS20+Hu8JEnE4D7i29QSPeIjHkGZDRD5bg1ch1tnqUeCEJc8 1nIU0lPNr/0r/ZWQgSZuDppLQT8XXMc60LyEJckxs4BaEYxeRvQCaLpdzu8+FG4b d9o556ZoyTJBfYIiM5Rx =fU8j -----END PGP SIGNATURE----- --------------enigD3929468B563F3580670B2A1--