Posts

Showing posts from March, 2011

Connecting to JMX with username and password

Got the tip from http://mx4j.sourceforge.net/docs/api/mx4j/tools/remote/PasswordAuthenticator.html ----------------------------------------- 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://11.11.11.11:711/jmxrmi"); 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);