MBean"jboss.web:type = Manager,path =/,host = localhost"未找到 [英] MBean "jboss.web:type=Manager,path=/,host=localhost" not found

查看:72
本文介绍了MBean"jboss.web:type = Manager,path =/,host = localhost"未找到的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试访问注册为 JBoss v4.2 的MBean

I'm trying to access the JBoss v4.2 MBean registered as

jboss.web:type=Manager,path=/,host=localhost

使用以下代码:

ObjectName name = new ObjectName("jboss.web:type=Manager,path=/,host=localhost");
ManagementFactory.getPlatformMBeanServer().getAttribute(name, "activeSessions");

但是此代码不断引发以下异常:

But this code keeps throwing the following exception:

javax.management.InstanceNotFoundException : jboss.web:type=Manager,path=/,host=localhost is not registered.

另一方面,我可以通过...//localhost:8080/jmx-console/在jmx-console上查看和使用此bean-MBean可用.

On the other hand I'm able to see and use this bean using the jmx-console via ...//localhost:8080/jmx-console/ - the MBean is available.

通过代码访问同一MBean还需要什么?

What else is necessary to access the same MBean via code?

推荐答案

找到了...

ObjectName name = new ObjectName("jboss.web:type=Manager,path=/,host=localhost");
this.sessions = new Long((Integer) MBeanServerLocator.locateJBoss().getAttribute(name, "activeSessions"));

我必须找到正确的MBeanServer ... MBeanServerLocator.locateJBoss()解决了它.

I had to find the right MBeanServer... MBeanServerLocator.locateJBoss() solves it.

这篇关于MBean"jboss.web:type = Manager,path =/,host = localhost"未找到的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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