Hello,
I am trying to implemet JMX client / server side.
I am using JSR-160 Connectors.
Any help is appreciated.
I create a server and register a POJO as an MBEAN on a remote MBEAN server (although I am pointing to localhost).
My client is then trying to access the the MBEAN on the remote MBEAN server.
I successfully register the bean on the MBEAN server using ConnectorServerFactoryBean.
But when I run the client I am getting the following exception:
Exception in thread "main" org.springframework.beans.factory.BeanCreationExce ption: Error creating bean with name 'mbeanExporter' defined in class path resource [com/interface21/spring/jmx/basic/clientDemo.xml]: Invocation of init method failed; nested exception is org.springframework.jmx.access.InvalidInvocationEx ception: Operation 'toString' is not exposed on the management interface
Caused by: org.springframework.jmx.access.InvalidInvocationEx ception: Operation 'toString' is not exposed on the management interface
at org.springframework.jmx.access.MBeanClientIntercep tor.invokeOperation(MBeanClientInterceptor.java:35 9)
at org.springframework.jmx.access.MBeanClientIntercep tor.invoke(MBeanClientInterceptor.java:302)
at org.springframework.aop.framework.ReflectiveMethod Invocation.proceed(ReflectiveMethodInvocation.java :161)
at org.springframework.aop.framework.JdkDynamicAopPro xy.invoke(JdkDynamicAopProxy.java:203)
at $Proxy0.toString(Unknown Source)
at java.lang.String.valueOf(String.java:1499)
at java.lang.StringBuffer.append(StringBuffer.java:22 0)
at org.springframework.jmx.export.MBeanExporter.creat eAndConfigureMBean(MBeanExporter.java:710)
at org.springframework.jmx.export.MBeanExporter.regis terBeanInstance(MBeanExporter.java:601)
at org.springframework.jmx.export.MBeanExporter.regis terBeanNameOrInstance(MBeanExporter.java:570)
at org.springframework.jmx.export.MBeanExporter.regis terBeans(MBeanExporter.java:499)
at org.springframework.jmx.export.MBeanExporter.after PropertiesSet(MBeanExporter.java:388)
at org.springframework.beans.factory.support.Abstract AutowireCapableBeanFactory.invokeInitMethods(Abstr actAutowireCapableBeanFactory.java:1175)
at org.springframework.beans.factory.support.Abstract AutowireCapableBeanFactory.initializeBean(Abstract AutowireCapableBeanFactory.java:1145)
at org.springframework.beans.factory.support.Abstract AutowireCapableBeanFactory.createBean(AbstractAuto wireCapableBeanFactory.java:427)
at org.springframework.beans.factory.support.Abstract BeanFactory$1.getObject(AbstractBeanFactory.java:2 51)
at org.springframework.beans.factory.support.DefaultS ingletonBeanRegistry.getSingleton(DefaultSingleton BeanRegistry.java:144)
at org.springframework.beans.factory.support.Abstract BeanFactory.getBean(AbstractBeanFactory.java:248)
at org.springframework.beans.factory.support.Abstract BeanFactory.getBean(AbstractBeanFactory.java:160)
at org.springframework.beans.factory.support.DefaultL istableBeanFactory.preInstantiateSingletons(Defaul tListableBeanFactory.java:279)
at org.springframework.context.support.AbstractApplic ationContext.refresh(AbstractApplicationContext.ja va:360)
at org.springframework.context.support.ClassPathXmlAp plicationContext.<init>(ClassPathXmlApplicationCon text.java:91)
at org.springframework.context.support.ClassPathXmlAp plicationContext.<init>(ClassPathXmlApplicationCon text.java:75)
at org.springframework.context.support.ClassPathXmlAp plicationContext.<init>(ClassPathXmlApplicationCon text.java:65)
at com.interface21.spring.jmx.basic.ClientDemo.main(C lientDemo.java:31)
Here is my server side xml:
<beans>
<bean id="registry" class="org.springframework.remoting.rmi.RmiRegistr yFactoryBean">
<property name="port" value="8999"/>
</bean>
<bean id="serverConnector"
class="org.springframework.jmx.support.ConnectorSe rverFactoryBean">
<property name="objectName" value="connector:name=rmi"/>
<property name="serviceUrl"
value="service:jmx:rmi://localhost/jndi/rmi://localhost:8999/myconnector"/>
</bean>
<!-- define an MBeanExporter -->
<bean id="mbeanExporter" class="org.springframework.jmx.export.MBeanExporte r" lazy-init="false">
<!-- the beans to be exported to JMX -->
<property name="beans">
<map>
<entry key="i21:name=messageService">
<ref local="basicBean"/>
</entry>
</map>
</property>
</bean>
<!-- define a simple service bean -->
<bean id="basicBean" class="com.interface21.spring.jmx.basic.MessageSer vice"/>
Here is my client side xml:
<beans>
<!-- define a simple service bean -->
<!-- define an MBeanExporter -->
<bean id="mbeanExporter" class="org.springframework.jmx.export.MBeanExporte r" lazy-init="false">
<!-- the beans to be exported to JMX -->
<property name="autodetectModeName" value="AUTODETECT_ALL" />
<property name="beans">
<map>
<entry key="Services:name=proxy"
value-ref="proxy" />
</map>
</property>
</bean>
<bean id="clientConnector" class="org.springframework.jmx.support.MBeanServer ConnectionFactoryBean">
<property name="serviceUrl" value="service:jmx:rmi:///jndi/rmi://localhost:8999/myconnector"/>
</bean>
<bean id="proxy" class="org.springframework.jmx.access.MBeanProxyFa ctoryBean">
<property name="objectName" value="i21:name=messageService"/>
<property name="proxyInterface" value="com.interface21.spring.jmx.basic.MessageSer viceInf"/>
<property name="server" ref="clientConnector"/>
</bean>


Reply With Quote