Can I run MBean under Tomcat?

We have 2 applications that work under JBoss. I am looking for a way to reduce server overhead. The main application runs under Tomcat. Another application consists of MBeans. Is there a way to run MBeans under Tomcat?

Alternative suggestions appreciated.

+3
source share
4 answers

MBeans are part of the JMX specification that is included in the JRE. It should be possible to run MBeans under Tomcat. Tomcat 5 or later provides an MBean server.

+5
source

You can use the following JVM arguments to start Tomcat with MBean enabled

-Dcom.sun.management.jmxremote
-Dcom.sun.management.jmxremote.port=4444 (could be anything)
-Dcom.sun.management.jmxremote.ssl=false
-Dcom.sun.management.jmxremote.authenticate=false
+2
source

MBean, tomcat, - :

    // find the existing MBean server (tomcat's) in lieu of
    // creating our own
    //
    ArrayList<MBeanServer> mbservers = MBeanServerFactory
            .findMBeanServer(null);

    int nservers = mbservers.size();
    if (nservers > 0) {
        //
        // TODO: A better way to get the currently active server ?
        // For some reason, every time the webapp is reloaded there is one
        // more instance of the MBeanServer
        mbserver = (MBeanServer) mbservers.get(nservers - 1);
    }

    if (mbserver == null) {
        mbserver = MBeanServerFactory.createMBeanServer();
    }
+2

All Articles