Forcing Spring MBeanExporter to use a specific MBeanServer

I have a web application running on JBoss 4.2.2. To control performance, I turned on the internal JMX platform server that ships with Java 5. In other words, I added:

-Dcom.sun.management.jmxremote

to run the jboss script. This works as expected. However, as a result, all MBeans are now registered on the MBeanServer platform. I do not want this, I want them to be registered on MBeanServer JBoss.

The difficulty is that I use Spring to register my managed beans. Used for this MBeanExporter. Thus, I need to tell my to MBeanExporteruse MBeanServer JBoss when registering beans. However, the only impacting method in MBeanExporteraffecting the server is setServer(MBeanServer mBeanServer). The problem is that I only know how to get the link to the correct MBeanServer programmatically, and not in Spring XML where it is declared MBeanExporter.

My options are as follows:

  • Write the subclass in MBeanExporter, overriding some methods, so the correct MBeanServer will load
  • Write PostBeanProcessorthat finds MBeanServer JBoss and then callssetServer
  • JNDI? It only works if MBeanServer is displayed in JNDI and I could not find it.

? - ?

+3
2

factory JBoss API MBeanServer MBeanExporter:

<bean class="org.springframework.jmx.export.MBeanExporter">
    <property name="server">
        <bean class="org.jboss.mx.util.MBeanServerLocator" factory-method="locateJBoss"/>
    </property>
    <!-- Add the rest of your MBeanExporter properties here -->
</bean>
+6

, , MBeanServer

, MBeanExporter #?

0

Source: https://habr.com/ru/post/1715430/


All Articles