Skip to content

Instantly share code, notes, and snippets.

View gertv's full-sized avatar

Gert Vanthienen gertv

View GitHub Profile
@gertv
gertv / gist:5601849
Created May 17, 2013 20:45
Quick code snippet that show how to set up a JMX connection to Apache ServiceMix
JMXServiceURL url = new JMXServiceURL("service:jmx:rmi:///jndi/rmi://localhost:1099/karaf-root");
Map<String, Object> parameters = new HashMap<String, Object>();
String[] credentials = new String[] {"smx" ,"smx" };
parameters.put("jmx.remote.credentials", credentials);
JMXConnector jmxc = JMXConnectorFactory.connect(url, parameters);
MBeanServerConnection mbsc = jmxc.getMBeanServerConnection();
// TODO: work with the connection here!