|
From: Scott B. <sco...@ru...> - 2005-02-22 21:59:16
|
Mike, Thomas, Those are perfect resources. Thanks! Maybe the Wiki can be updated with this information for anyone else looking for it? I'm assuming the MBeanAdapter is the MBeanExporter? Thanks -Scott Michael Schuerig wrote: >On Tuesday 22 February 2005 21:26, Scott Battaglia wrote: > > > >>Okay, I'll look for them after the 1.1.5 release then! In the mean >>time are any of the test cases a good kind of guide to follow? I'm >>not too familar with JMX so I'm learning JMX and trying to figure out >>the Spring support at the same time (probably not a good >>combination). >> >> > >If all you want to do is expose a Spring bean as an MBean it's actually >pretty easy and doesn't require any code. > >Create an MBeanServer registered as a bean > > <bean id="mbeanserver" > class="org.springframework.jmx.factory.MBeanServerFactoryBean"> > <property name="defaultDomain"><value>MyDomain</value></property> > </bean> > >Wrap an MBean adapter around my repositorymanager bean (not shown), >which is a completely ordinary java object. In this case, public >methods are exposed as attributes/operations. Alternatively, metadata >can be used. > > <bean id="mbeanadapter" > class="org.springframework.jmx.JmxMBeanAdapter"> > <property name="server"><ref local="mbeanserver"/></property> > <property name="beans"> > <map> > <entry key="MyDomain:id=Repository"> > <ref bean="repositorymanager"/> > </entry> > </map> > </property> > </bean> > >Create a connector listening, by default, on >service:jmx:jmxmp://localhost:9876 (this requires >jmxremote_optional.jar) > > <bean id="jmxconnector" > class="org.springframework.jmx.support.ConnectorServerFactoryBean"> > <property name="server"> > <ref local="mbeanserver" /> > </property> > <!-- This is the default URL anyway --> > <property name="serviceUrl"> > <value>service:jmx:jmxmp://localhost:9876</value> > </property> > <property name="threaded"> > <value>true</value> > </property> > <!-- Ensure the connector thread doesn't keep the > servlet container running --> > <property name="daemon"> > <value>true</value> > </property> > </bean> > > >HTH, >Michael > > > |