final String password = config.remove("password");
final String mbean_domains = config.remove("mbean_domains");
final String jmxGlassFishConnectorString =
"service:jmx:rmi:///jndi/rmi://" + host + ":" + port + "/jmxrmi";
try {
final JMXServiceURL jmxUrl =
new JMXServiceURL(jmxGlassFishConnectorString);
final Map<String,String[]> jmxEnv = new HashMap<String, String[]>();
final String[] credentials = new String[] {username, password};
jmxEnv.put( JMXConnector.CREDENTIALS, credentials );
final JMXConnector connector =
JMXConnectorFactory.connect(jmxUrl, jmxEnv);