Connecting to JMX with username and password

Got the tip from
echo("\nCreate an RMI connector client and " +
"connect it to the RMI connector server");
JMXServiceURL url =
//new JMXServiceURL("service:jmx:rmi:///jndi/rmi://localhost:9999/jmxrmi");
new JMXServiceURL("service:jmx:rmi:///jndi/rmi://");

String[] credentials = new String[2];
// The user will travel as clear text
credentials[0] = "user"; //user name
credentials[1] = "password"; //password

Map environment = new HashMap();

environment.put(JMXConnector.CREDENTIALS, credentials);

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


Popular posts from this blog

Long running Java process resource consumption monitoring , leak detection and GC tuning

OpenLayers Advanced Clustering and Setting dynamic images for OpenLayer Styles via Ajax

Best practises - Selenium WebDriver/ Java