Java Mailing List Archive

http://www.junlu.com/

Home » Home (12/2007) » Tomcat Users »

control own servlets with jmx

Jan von Bargen

2003-08-20


hello,

i want to control my own servlets the same way tomcat does in the admin-section. how do i do that ? the best solution would be that my servlets implements some interface and i have some methods to access remotely in the servlet class.

i first tried to register this servlet in the registry, but i figured out some problems:

when jmx tries to load my servlet-class it fails because it doesn't find it. having a closer look to it i found out that there are two ways to register:

1. server.createMBean(mbeanName,mbeanObjectName);

then jmx tries to load with an own classloader - but no classloaders are in it

2. server.createMBean(mbeanName,mbeanObjectName,null);

then jmx tries to load with the tomcat classloader, but only with that one which accesses the common/lib-directory. my servlet is - as usual - in web-inf/.... so i can load classes which are in the common/lib-directory - that works - by the way !

to get a server i'm using the Registry-object from the commons-project - i thought that maybe this is the way to get the right server object, because tomcat uses this one as well - i'm using tomcat 4.1.27 on windows xp.


so i have a problem understanding how this could work, because normally i want to access a class already instantiated - a servlet - via jmx. but even my approach doesn't help in this case.

thanks,

jan
©2008 junlu.com - Jax Systems, LLC, U.S.A.