in common/src/main/java/org/apache/cassandra/sidecar/common/JmxClient.java [159:187]
private void connect()
{
try
{
jmxConnector = JMXConnectorFactory.connect(jmxServiceURL, buildJmxEnv());
jmxConnector.addConnectionNotificationListener(this, null, null);
mBeanServerConnection = jmxConnector.getMBeanServerConnection();
connected = true;
}
catch (IOException iox)
{
connected = false;
throw new RuntimeException(String.format("Failed to connect to JMX endpoint %s", jmxServiceURL),
iox);
}
catch (SecurityException securityException)
{
connected = false;
String errorMessage = securityException.getMessage() != null
? securityException.getMessage()
: "JMX Authentication failed";
throw new JmxAuthenticationException(errorMessage, securityException);
}
catch (RuntimeException runtimeException)
{
// catch exceptions coming from the lambdas and wrap them in a JmxAuthenticationException
throw new JmxAuthenticationException(runtimeException);
}
}