tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Pid <...@pidster.com>
Subject Re: MBean InitialContext() Tomcat query- pls help
Date Thu, 22 Dec 2011 15:19:54 GMT
On 22/12/2011 10:34, Konstantin Kolinko wrote:
> 2011/12/20 S B <sblvrg@gmail.com>:
>> Hi,
>>
>> I created and deployed an MBean in my tomcat. It uses datasource to connect
>> 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. However
>> when I create InitialContext() in DBManager  class, it fails.
> 
> IIRC what InitialContext() sees as its environment highly depends on
> what classloader is active. That is TCCL =
> Thread.getContextClassLoader().
> 
> So while it is run from within web application your TCCL = your
> webapp's classloader.
> 
> When it is invoked from jconsole it might be a separate Thread, not
> related to your web application.


Like he ^^^ said.  :)


p


-- 

[key:62590808]


Mime
View raw message