PDA

View Full Version : ConnectorServerFactoryBean registration


zibi101
Apr 3rd, 2006, 10:56 AM
Hi,

I have configured MBeanExporter which uses AnnotationJmxAttributeSource. The problem appear with the registration of connector. The configuration of the connector:

<bean id="serverConnector" class="org.springframework.jmx.support.ConnectorServerFac toryBean">
<property name="objectName" value="connector:name=rmi"/>
<property name="serviceUrl" value="service:jmx:rmi://localhost:9875"/>
<property name="server" ref="mbeanServer"></property>
</bean>


Using spring1.2.6 with the same configuration it works. ConnectorServerFactoryBean is recognised as a bean to export, then spring tries to get the annotation for it. Because of the fact that annotation for ConnectorServerFactoryBean does not exist the MalformedObjectNameException is thrown which is caught in MBeanExporter.registerMBean method and log with debug level. The registration process is not stopped and I have registered all other beans and ConnectorServerFactoryBean too.
Looking at the changes, since patch1.27 the exception handling in MBeanExporter.registerMBean is removed. This cause that the registration of mbeans is stopped and all beans are removed from mbeanServer. I get the following exception

orgg.springframework.jmx.export.UnableToRegisterMB eanException: Unable to register MBean [javax.management.remote.rmi.RMIConnectorServer@1d7 fbfb] with key [serverConnector]; nested exception is javax.management.MalformedObjectNameException: Your bean class [javax.management.remote.rmi.RMIConnectorServer] must be marked with a valid ManagedResource attribute when using MetadataNamingStrategy


Question:
How can I register "ConnectorServerFactoryBean" using autodetect strategy with annotation ?

zibi101
Apr 5th, 2006, 09:10 AM
OK, I found the answer. Instead of setAutodetect(boolean) I had to use setAutodetectMode(MBeanExporter.AUTODETECT_ASSEMBL ER).