Announcement Announcement Module
Collapse
No announcement yet.
using MBeanExporter with remote MBean server Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • using MBeanExporter with remote MBean server

    How do I use the MBeanExporter to register my management beans with a remote MBean server? I want to be able to use either 1) another running instance of my spring container that exposes a ConnectorServerFactoryBean using a specific url, or 2) a 3rd party instance running either on the same physical server or on a remote server on my network.

    I thought that setting locateExistingServerIfPossible to true on the MBeanServerFactoryBean would find a running mbean server on my local machine, but maybe it just finds a running mbean server running in the same VM?

    I'm sure I'm just missing something. Can someone enlighten me?

    Thanks.

  • #2
    just to clarify...

    Basically, I want to register my MBeans with a central MBean server. I should have said that in the original post.

    Does spring support this out of the box?

    Comment


    • #3
      I had a similar problem and I couldn't solve it with the support provided out-of-the-box. In my case, I wanted to register notification listeners against a remote MBeanServer (see my previous post http://forum.springframework.org/showthread.php?t=27473 for details).

      I think it is basically a design flaw in the Spring JMX support, because the MBeanRegistrationSupport use a MBeanServer interface, which is intended only for local MBeanServers. IMHO, it should use the javax.management.MBeanServerConnection interface (which is a superinterface of MBeanServer) and then it would allow operations over a local or remote MBeanServer. I ended up making my own registration class, because the MBeanExporter didn't allow me to register notification listeners without register MBeans...

      The configuration looks like:

      Code:
          <!-- Connector to the remote MBeanServer -->
          <bean id="mbeanServerProxy1" class="org.springframework.jmx.support.MBeanServerConnectionFactoryBean" lazy-init="false">
               <property name="serviceUrl" value="service:jmx:rmi://localhost/jndi/rmi://localhost:33333/IBJMXConnector"/>
          </bean>
      
          <!-- Bean that registers the JMX connector with the remote MBeanServer to listen notifications -->
          <bean id="listenersRegisterer" class="es.indra.ibuilder.jmx.notifications.RemoteNotificationListenerRegisterer">
              <property name="defaultServer">
      			<ref bean="mbeanServerProxy1"/>        
              </property>
      		<property name="notificationListeners">
      			<list>
      				<ref bean="jmxReadConnectorConfig"/>				
                  </list>
              </property>        
          </bean>  
      ...
      In your case you probably could rewrite the MBeanRegistrationSupport to use a MBeanServerConnection and then you should be able to use the MBeanExporter with remote MBeanServers. Something like:

      Code:
          <!-- Connector to the remote MBeanServer -->
          <bean id="mbeanServerProxy1" class="org.springframework.jmx.support.MBeanServerConnectionFactoryBean" lazy-init="false">
               <property name="serviceUrl" value="service:jmx:rmi://localhost/jndi/rmi://localhost:33333/IBJMXConnector"/>
          </bean>
      
          <bean id="jmxExporter" class="org.springframework.jmx.export.MBeanExporter">
              <property name="server" ref="mbeanServerProxy1"/>
              <property name="beans">
      ...
          </bean>
      Hope this helps,

      Jose Luis.

      Comment


      • #4
        On you example you register notification listener on a remote server, exists any form that you can inject beans obtained from a client connector to a local(POJO)bean?

        Comment

        Working...
        X