On 22/12/2011 10:34, Konstantin Kolinko wrote: > 2011/12/20 S B <sbl...@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]
signature.asc
Description: OpenPGP digital signature