如何在 Spring 集成中连接到远程 MBean Server

How to connect to remote MBean Server in Spring integration

我想监控我的 Spring 集成服务器,它是 运行 在使用 MBean 的远程计算机上。 我将以下内容添加到 spring 上下文文件中。

<context:mbean-server />
<int-jmx:mbean-export id="integrationMBeanExporter" default-domain="spring.application" />

这应该能够使用 VisualVM 查看 MBean 信息,例如 MessageCount、运行 状态等。 我不确定如何远程连接到 MBean 服务器。

VisualVM 有两种连接到远程 JMX 服务器的方法。 hostname:port 或 service:jmx::

是否有 MBeanServer 运行的默认端口? 使 MBean 可以远程访问吗?远程访问 MBean 需要做些什么吗?

谢谢

JMX 使用 JSR-160 连接器,使用对防火墙不是特别友好的 RMI。

您还需要启用远程访问,包括一个端口;见 oracle documentation.

Spring 提供支持 类 以允许您在另一个 spring 应用程序 see the Spring JMX documentation.

中访问 MBean

最后,您可以考虑使用 jolokia 之类的东西作为 JSR-160 的替代方案,通过 HTTP 公开您的 MBean。