如何管理JMX Web应用程序 [英] How to manage a JMX web application

查看:59
本文介绍了如何管理JMX Web应用程序的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已经在页面上完成了该过程,以公开Web应用程序.

I've gone through the process on this page to expose the JMX interface of a web application.

我设法查看了Tomcat JMX代理上的公开接口,但是当我加载JConsole并查找公开的mbean接口时,我找不到与公开的属性和操作相关的任何东西.

I've managed to view the exposed interface on the Tomcat JMX proxy but when I load JConsole and look for the exposed mbean interface I can't find anything related to the attributes and operations exposed.

在jconsole上没有用于Web应用程序的特定条目,因此我认为它可能在TOMCAT jmx条目下.它不是. (请记住,我确实设法在tomcat jmx代理页面上看到了它.)

Thre is no specific entry on jconsole for the web app so I figured it might be under the TOMCAT jmx entry. It's not. (bare in mind, I did manage to see it on the tomcat jmx proxy page).

如何在本地管理我的Web应用程序?为什么JConsole不显示它?

How can I manage my web application locally? Why is JConsole not showing it?

推荐答案

我已通过执行一些基本步骤来解决此问题-

I've managed to fix this by doing a few basic steps -

  1. 在webapp上下文侦听器contextInitialized方法中,我实例化了一个将运行并实现mbean的单例类(servlet本身无法实现mbean,因为它仅醒来以接受来自服务器的请求).
  2. servlet会通知"我们要监视的每个操作的单例,而单例实际上是通过jmx进行报告的单例.
  3. 在我通过以下命令向mbean服务器注册的单例中:

  1. In the webapp context listener contextInitialized method, I instantiated a singleton class that will run and implement the mbean (the servlet itself cannot implement an mbean because it only wakes up to take requests from the server).
  2. The servlet "informs" the singleton of every operation that we want to monitor and the singleton is the one that actually reports this through jmx.
  3. In the singleton I registered with the mbean server with this command:

ManagementFactory.getPlatformMBeanServer().registerMBean(this,name);

ManagementFactory.getPlatformMBeanServer().registerMBean(this, name);

就这样. (在坚果壳中)

Thats it. (In a nut shell)

这篇关于如何管理JMX Web应用程序的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆