问题描述
我在Solaris 10服务器上的twiddle
脚本有问题.我必须阅读一些属性,例如jboss.system
和其他.取决于jboss服务器的所有属性都可以,但是当我尝试时从java.lang
读取属性,会发生以下错误:
I have a problem with the twiddle
script on a Solaris 10 server.I have to read some properties e.g jboss.system
and others.All properties depending on the jboss server are fine, but when I tryto read properties from java.lang
, the following error occurs:
javax.management.InstanceNotFoundException: java.lang:type=Runtime is not registered.
推荐答案
问题是 java.lang:type = Runtime 是平台MBeanServer 注册的MBean,并且默认情况下,twiddle将您连接到 JBoss MBeanServer ,该服务器默认情况下不会注册RuntimeMXBean服务器.
The problem is that java.lang:type=Runtime is a Platform MBeanServer registered MBean and by default, twiddle connects you to the JBoss MBeanServer which by default, will not have the RuntimeMXBean server registered.
假设您只想访问系统属性,最简单的解决方法是将旋转指向JBoss MBean jboss:name = SystemProperties,type = Service . MBean公开:
The easiest way to resolve this, assuming you only want to access system properties, is to point twiddle at the JBoss MBean jboss:name=SystemProperties,type=Service. The MBean exposes:
String get(String key)
String get(String key, String default)
或检索所有值,
Map shopwAll()
其他更费力的解决方案包括:
Other more laborious solutions would inlcude:
- 在JBoss MBeanServer中注册Platform MBeanServer MXBean.参见此问题.
- 在JVM中启用管理代理,并使用JMX连接器连接到Platform MBeanServer.参见此问题.
- 使用附加API 通过进程ID连接到JBoss Server的Platform MBeanServer.然后,您可以引用MXRuntime MBean.
- Register the Platform MBeanServer MXBeans in the JBoss MBeanServer. See this Question.
- Enable the management agent in the JVM and use a JMX Connector to connect to the Platform MBeanServer. See this Question.
- Use the Attach API to connect to the Platform MBeanServer of your JBoss Server by process ID. You can then reference the MXRuntime MBean.
这篇关于JBoss JMX twiddle运行时未注册的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!