Openfire 3.9.1 – Enable JMX

First, you need to add the following to System Properties via the Web Admin Console or add into the table ofproperty.
xmpp.jmx.enabled true
xmpp.jmx.port 9111
xmpp.jmx.secure false

To test it, use the code snippet:

String serverUrl = "service:jmx:rmi:///jndi/rmi://localhost:9111/jmxrmi";

JMXServiceURL url = new JMXServiceURL(serverUrl);

JMXConnector jmxc = JMXConnectorFactory.connect(url, null);

MBeanServerConnection mbsc = jmxc.getMBeanServerConnection();

ObjectName objectName = new ObjectName("org.eclipse.jetty.webapp:type=webappcontext,id=0,name=ROOT");

Object response = mbsc.getAttribute(objectName, "started");

jmxc.close();



Open your own Online Store and Grow Your Sales! Try it Free Now with Bigcommerce!

You could tighten the security by change xmpp.jmx.secure to true. In this case, user name and password must be supplied during connection establishment.




String serverUrl = "service:jmx:rmi:///jndi/rmi://localhost:9111/jmxrmi";

JMXServiceURL url = new JMXServiceURL(serverUrl);

Map<String, String[]> map = Collections.singletonMap(JMXConnector.CREDENTIALS, new String[]{"admin", "password"});

JMXConnector jmxc = JMXConnectorFactory.connect(url, map);

MBeanServerConnection mbsc = jmxc.getMBeanServerConnection();

ObjectName webAppContext = new ObjectName("org.eclipse.jetty.webapp:type=webappcontext,id=0,name=ROOT");

Object response = mbsc.getAttribute(webAppContext, "started");

jmxc.close();
Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s