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.

Best regards,
Konstantin Kolinko

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org
For additional commands, e-mail: users-h...@tomcat.apache.org

Reply via email to