kernel.stop();
}
}
private void tryToConnect(String uri, JMXDeploymentManager.CommandContext commandContext, String driver, String user, String password, boolean authPrompt) throws DeploymentException {
DeploymentFactoryManager mgr = DeploymentFactoryManager.getInstance();
if(driver != null) {
loadDriver(driver, mgr);
} else {
mgr.registerDeploymentFactory(new DeploymentFactoryImpl());
}
try {
manager = mgr.getDeploymentManager(uri == null ? DEFAULT_URI : uri, user, password);
} catch(AuthenticationFailedException e) { // server's there, you just can't talk to it
if(authPrompt && (user == null || password == null)) {
doAuthPromptAndRetry(uri, commandContext, user, password);
} else {
throw new DeploymentException("Login Failed");