Skip to content

Instantly share code, notes, and snippets.

@gertv
Created May 17, 2013 20:45
Show Gist options
  • Save gertv/5601849 to your computer and use it in GitHub Desktop.
Save gertv/5601849 to your computer and use it in GitHub Desktop.
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!
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment