environment.put(JMXConnector.CREDENTIALS, credentials);
environment.put(JMXConnectorFactory.DEFAULT_CLASS_LOADER, BaseDeploymentFactory.class.getClassLoader());
try {
JMXServiceURL address = new JMXServiceURL("service:jmx:rmi:///jndi/rmi://"+params.getHost()+":"+params.getPort()+"/JMXConnector");
JMXConnector jmxConnector = JMXConnectorFactory.connect(address, environment);
RemoteDeploymentManager manager = getRemoteDeploymentManager();
manager.init(jmxConnector, params.getHost());
if(!manager.isSameMachine()) {
manager.setAuthentication(username, password);
}
return manager;
} catch (IOException e) {
throw (DeploymentManagerCreationException)new DeploymentManagerCreationException(e.getMessage()).initCause(e);
} catch (SecurityException e) {