Results 1 to 4 of 4

Thread: using MBeanExporter with remote MBean server

  1. #1
    Join Date
    Aug 2006
    Posts
    3

    Default 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. #2
    Join Date
    Aug 2006
    Posts
    3

    Default

    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?

  3. #3
    Join Date
    Mar 2006
    Location
    Spain
    Posts
    41

    Default

    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.

  4. #4
    Join Date
    Jun 2007
    Posts
    16

    Default

    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?

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •