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.