Java Spring MBean客户端认为MBean服务是RMI连接
我在将自己的Spring MBean客户端连接到“Hello World!”服务时遇到问题,如图所示。服务和包含的客户端工作正常 我认为这与RMI连接在期待其他东西时返回有关。。。但我不知道解决方案是什么,甚至不知道这是否是一个正确的推论 还是我使用了“错误”的MBeanServerConnectionFactoryBean 有什么想法吗 下面是我对这个bean的spring配置:Java Spring MBean客户端认为MBean服务是RMI连接,java,spring,rmi,jmx,mbeans,Java,Spring,Rmi,Jmx,Mbeans,我在将自己的Spring MBean客户端连接到“Hello World!”服务时遇到问题,如图所示。服务和包含的客户端工作正常 我认为这与RMI连接在期待其他东西时返回有关。。。但我不知道解决方案是什么,甚至不知道这是否是一个正确的推论 还是我使用了“错误”的MBeanServerConnectionFactoryBean 有什么想法吗 下面是我对这个bean的spring配置: <beans xmlns="http://www.springframework.org/schema/be
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans-3.0.xsd">
<bean id="mBeanServerClient"
class="org.springframework.jmx.support.MBeanServerConnectionFactoryBean">
<property name="serviceUrl"
value="service:jmx:rmi://localhost/jndi/rmi://localhost:9999/jmxrmi" />
</bean>
<bean id="jmxClient"
class="com.foo.jmx.MBeanPollingClient">
<property name="mbeanServerConnection"
ref="mBeanServerClient" />
</bean>
</beans>
我得到的错误是:
原因:org.springframework.beans.factory.BeanCreationException:
创建类路径中定义了名为“jmxClient”的bean时出错
resource[jmx beans.xml]:bean初始化失败;嵌套
例外是
org.springframework.beans.ConversionNotSupportedException:未能
转换类型的属性值
'javax.management.remote.rmi.RMIConnector$RemoteMBeanServerConnection'
到所需类型
'org.springframework.jmx.support.MBeanServerConnectionFactoryBean'用于
属性“mbeanServerConnection”;嵌套异常是
java.lang.IllegalStateException:无法转换类型的值
[javax.management.remote.rmi.RMIConnector$RemoteMBeanServerConnection]
到所需类型
[org.springframework.jmx.support.MBeanServerConnectionFactoryBean]用于
属性“mbeanServerConnection”:没有匹配的编辑器或转换
策略发现
Spring将为您提供工厂提供的
MBeanServerConnection
。要修复错误,只需更改
private MBeanServerConnectionFactoryBean mbeanServerConnection;
到
你的问题是背对背的。您查找的是一个JMX服务bean连接。例外情况是这样的。真正的问题是为什么您认为它会是其他的东西?我使用的代码是直接从Spring示例复制的-我认为它可以连接到JMX服务Bean,因为这似乎是Spring连接器的整个前提。我并不期望该属性是RMI连接,但异常情况似乎认为它是-返回的东西显然是一个RMI连接。我读错了吗?你知道为什么吗?是否有文件说明原因?
private MBeanServerConnectionFactoryBean mbeanServerConnection;
private MBeanServerConnection mbeanServerConnection;