- android - 多次调用 OnPrimaryClipChangedListener
- android - 无法更新 RecyclerView 中的 TextView 字段
- android.database.CursorIndexOutOfBoundsException : Index 0 requested, 光标大小为 0
- android - 使用 AppCompat 时,我们是否需要明确指定其 UI 组件(Spinner、EditText)颜色
我在将自己的 Spring MBean 客户端连接到“Hello World!”时遇到问题。服务如JMX examples from Oracle中所示。该服务和包含的客户端工作正常。
我认为这与 RMI 连接在期待其他内容时返回有关...但我不知道解决方案是什么,或者即使这是一个正确的推论。
或者我是否以某种方式使用了“错误的”MBeanServerConnectionFactoryBean?
有什么想法吗?
这是我对该 bean 的 spring 配置:
<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>
这是我的实现代码:
import org.springframework.jmx.support.MBeanServerConnectionFactoryBean;
public class MBeanPollingClient {
private MBeanServerConnectionFactoryBean mbeanServerConnection = null;
public void setMbeanServerConnection ( MBeanServerConnectionFactoryBean m )
{
mbeanServerConnection = m;
}
public MBeanServerConnectionFactoryBean getMbeanServerConnection ( )
{
return mbeanServerConnection;
}
}
我收到的错误:
Caused by: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'jmxClient' defined in class path resource [jmx-beans.xml]: Initialization of bean failed; nested exception is org.springframework.beans.ConversionNotSupportedException: Failed to convert property value of type 'javax.management.remote.rmi.RMIConnector$RemoteMBeanServerConnection' to required type 'org.springframework.jmx.support.MBeanServerConnectionFactoryBean' for property 'mbeanServerConnection'; nested exception is java.lang.IllegalStateException: Cannot convert value of type [javax.management.remote.rmi.RMIConnector$RemoteMBeanServerConnection] to required type [org.springframework.jmx.support.MBeanServerConnectionFactoryBean] for property 'mbeanServerConnection': no matching editors or conversion strategy found
最佳答案
Spring会给你一个由工厂提供的MBeanServerConnection
。要修复错误,只需更改
private MBeanServerConnectionFactoryBean mbeanServerConnection;
至
private MBeanServerConnection mbeanServerConnection;
关于java - Spring MBean客户端认为MBean服务是RMI连接,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/20894897/
当我连接 JConsole 时,我看到一些 Bean 嵌套在其他 Bean 中。要访问嵌套 bean,我必须创建 mbean 服务器吗?通常我会像 spring beans 一样提供访问权限(在 be
我想注册多个相同类的 MBean。 我有 Hello 类实现了 HelloMBean 接口(interface)。 现在在 main 中我有两个 Hello 类的对象,我想注册它们 MBeanServ
我有 JBoss 的 SAR 存档,并且在 jboss-service.xml 中注册了一个 MBean。现在我想迁移到 TomEE 并使用标准 javax.management 注释 @MBean,
我有一堆标准 MBean,需要将其转换为动态 MBean(主要目的是向属性、操作和操作参数添加用户友好的描述)。我想知道是否有任何工具可以通过从现有标准 MBean 生成动态 MBean 的框架代码来
有什么区别: 标准 MBean 动态 MBean 它们各自的优缺点是什么?我们什么时候应该选择这两个组件中的任何一个来管理资源? 最佳答案 标准 mbean 具有固定的元数据,在 MBean 的生命周
我正在尝试通过 spring 注释注册 mbean。 bean 在 jconsole 中正确显示,但类中定义的属性和方法没有显示。这是怎么回事? 以下是一个 mbean 示例: @ManagedRes
我已经开始使用 MBean 来公开有关应用程序的一些信息。几乎全部的 HOWTO/教程/博客文章/在线示例都在教您如何实现 MBean 并将其注册到 MBean 服务器,但从未提及(或只是粗略地)从服
我有使用 Spring 创建的应用程序,并可以通过 jmx 访问来设置一些参数。问题是,当我通过 jconsole 访问时 - 一切正常,当从我的图形界面访问时 - 不起作用。在调试器中,我检查了是否
我使用 MBeanServerFactory.createMBeanServer 创建一个 mbean 服务器并向其注册 mbean。我可以在 jconsole 中找到 mbean 服务器,但是当我连
我正在寻找一种解决方案,以便从中央 MBean 服务器中的不同 Java VM 注册 MBean 或整个 MBean 服务器本身,该服务器也应该在单独的 VM 中运行。目标是只有一个中央 MBean
我试图理解为什么 MBean 在 Java 中如此重要,但我不记得任何其他语言有这样的范例或模式。 那么为什么存在 MBean,它们试图解决什么问题,以及其他语言是如何解决该问题的? (我更喜欢与 P
我有一些 JMX Beans 在我的应用程序中公开性能信息。我想要一些工具来在图表中绘制 MBean 的属性以进行监控(a la Windows Perf Mon)。我喜欢 JConsole 和 Vi
看来我的类是内部类这一事实导致了这个问题,这是我的预感 - 但基本上它是通常的模式: public class UserProvisionerProfiler implements UserProvi
我使用 jconsole 在 tomcat 容器中执行 mbean 的方法。当 Bean 的数量超过 100 时,似乎很难找到 Bean - 特别是当 Bean 位于层次结构较深的位置时。是否存在其他
在我的weblogic服务器中部署了ehcache,我需要通过java编程从这个程序中获取ehcahe mbean,通过JMX我无法连接。我怎样才能获得那些自定义mbean? 我尝试通过 weblog
我想通过java程序访问MemoryPool Mbeans,以便检索一段时间内的Eden Space、Perm Gen space、CodeCahe、Survior Space统计信息。这个怎么做?我
我创建了一个javaee应用程序,除其他外,它必须使用朴素贝叶斯执行情感分析。为了使情感算法发挥作用,我们必须首先对其进行训练,因此我想创建一个对象,在服务器启动时处理训练,以避免一遍又一遍地训练。我
我正在为一个 spring-boot 应用程序编写集成测试,我正在使用一个基本测试类来处理常见方法和所有其他常见的东西。像这样的东西: @ActiveProfiles("test") @RunWith
基本上,我遵循标准的基本 JMX 教程并使用两种方法注册 MXBean。 public interface QueueSamplerMXBean { public QueueSample ge
我在 Java 1.6 中使用平台 MBean 服务器,在 OSGi 容器中运行。 主要将 MBean 用于统计计数器和事件。它们的实现在一个包中,但它们在其他几个包中实例化。每个 MBean 都
我是一名优秀的程序员,十分优秀!