JBoss JMX twiddle Runtime not registered

2019-05-25 04:03发布

问题:

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 try to read properties from java.lang, the following error occurs:

javax.management.InstanceNotFoundException: java.lang:type=Runtime is not registered.

回答1:

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.

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)

or to retrieve all values,

Map shopwAll()

Other more laborious solutions would inlcude:

  • 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