I am currently trying to expose a few methods via JMX.
My context definition:
Code:<bean id="oosTasksMBean" class="de.net22.oos.service.jmx.OosTasksMBeanImpl"> <property name="jacStaticDataImportStrategy" ref="jacStaticDataImportStrategy"/> <property name="novasolStaticDataImportStrategy" ref="novasolStaticDataImportStrategy"/> <property name="interhomeStaticDataImportStrategy" ref="interhomeStaticDataImportStrategy"/> </bean> <bean id="mbeanServer" class="org.springframework.jmx.support.MBeanServerFactoryBean" /> <!-- this bean needs to be eagerly pre-instantiated in order for the exporting to occur; this means that it must not be marked as lazily initialized --> <bean id="exporter" class="org.springframework.jmx.export.MBeanExporter"> <property name="assembler" ref="assembler"/> <property name="namingStrategy" ref="namingStrategy"/> <property name="autodetect" value="false"/> <property name="server" ref="mbeanServer" /> <property name="beans"> <map> <entry key="bean:name=oosTasksMBean" value-ref="oosTasksMBean"/> </map> </property> </bean> <bean id="jmxAttributeSource" class="org.springframework.jmx.export.annotation.AnnotationJmxAttributeSource"/> <!-- will create management interface using annotation metadata --> <bean id="assembler" class="org.springframework.jmx.export.assembler.MetadataMBeanInfoAssembler"> <property name="attributeSource" ref="jmxAttributeSource"/> </bean> <!-- will pick up the ObjectName from the annotation --> <bean id="namingStrategy" class="org.springframework.jmx.export.naming.MetadataNamingStrategy"> <property name="attributeSource" ref="jmxAttributeSource"/> </bean>
Registering the MBean with a server seems to work, as I can find this message in the logfile:
Code:Located managed bean 'bean:name=oosTasksMBean': registering with JMX server as MBean [bean:name=oosTasksMBean]
My problem is: I cannoct connect to the MBeanServer with a JMX console. I get a "connection refused" error.
I have no idea which MBeanServer is used by Spring to expose the bean. I did not put any JMX imlementation on the classpath.
Which server is used by Spring? How can I adjust the server's settings like credentials and passwords?


Reply With Quote