RE: About JMX
"Bordet, Simone" <[email protected]>
| Newsgroups | gmane.comp.java.mx4j.devel |
|---|---|
| Message-ID | <[email protected]> |
Hi, > I work with JMX/J2SE and J2EE application and I have > someone question about > it: > > a. How method I use to find some agents/mbeanserver in own > domain(J2SE)? Discovery is not implemented yet in MX4J. We have plan to use Jini, but the code is still in our fingers. > b. I have to instrumentalization my web application that use > Jakarta/Tomcat > 5.0. How to create my agent to register my mbeans?How to > initialize my agent > class?How to find the servermbean that's run? See JMX-FORUM archives about how to use JMX from Tomcat. From any web app it is simply possible to create an MBeanServer and register several MBeans. This can be done inside an init() of a servlet. From a web app it should be possible to find Tomcat's MBeanServer, but that risks to tie your code to Tomcat; not because you use Tomcat APIs, but because maybe only Tomcat is able to allow a web app to see the servlet container's MBeanServer. Try this from inside a servlet init(): List servers = MBeanServerFactory.findMBeanServer(null); System.out.println(servers); If there is one MBeanServer, then it's Tomcat's. It may require that Tomcat's Context of your web app is configured with privileged="true". It is also very simple to use MX4J with Tomcat 5 that actually ships with JMXRI. Just do this: $TOMCAT/bin> mv jmx.jar jmx.jar.original $TOMCAT/bin> cp $MX4J/lib/mx4j.jar . $TOMCAT/bin> mv mx4j.jar jmx.jar That's it ! Simon ------------------------------------------------------- This SF.Net email sponsored by Black Hat Briefings & Training. Attend Black Hat Briefings & Training, Las Vegas July 24-29 - digital self defense, top technical experts, no vendor pitches, unmatched networking opportunities. Visit www.blackhat.com