connector = JMXConnectorFactory.connect(url, env);
connection = connector.getMBeanServerConnection();
name = JGDIAgent.getObjectNameFromConnectionId(connector.getConnectionId());
if (name == null) {
throw new JGDIException("jmx connection id contains no jgdi session id. Please check qmaster's JAAS configuration (JGDILoginModule)");
}
connection.addNotificationListener(name, this, null, null);
connector.addConnectionNotificationListener(this, null, connector.getConnectionId());
} catch (NullPointerException ex) {
close();
throw new JGDIException(ex, "jgdi mbean is null");
} catch (InstanceNotFoundException ex) {
close();
throw new JGDIException(ex, "jgdi mbean not active in qmaster");
} catch (IOException ex) {
close();
Throwable realError = null;
if ((realError = findCause(ex, SSLHandshakeException.class)) != null) {
throw new JGDIException(realError, "SSL error: " + realError.getLocalizedMessage());
} else if ((realError = findCause(ex, java.net.ConnectException.class)) != null) {
throw new JGDIException(realError, "Connection refused");
}
throw new JGDIException(ex, "connection to " + url + "failed");
}
}
}