I'm incorporating cassandra-unit into our test suite, but I get the following error when I hit code that attempts to connect to cassandra via JMX. Should I be able to connect via JMX to the embedded cassandra server? Do I have to change some configuration to enable it?
The exception I get is:
java.io.IOException: Failed to retrieve RMIServer stub: javax.naming.ServiceUnavailableException [Root exception is java.rmi.ConnectException: Connection refused to host: localhost; nested exception is:
java.net.ConnectException: Connection refused]
When executing the following:
private static final String URL_TEMPLATE = "service:jmx:rmi:///jndi/rmi://%s:%d/jmxrmi";
private static JMXConnector getConnector(String jmxHost, int jmxPort) {
String urlString = String.format(URL_TEMPLATE, jmxHost, jmxPort);
try {
JMXServiceURL url = new JMXServiceURL(urlString);
return JMXConnectorFactory.connect(url, null);
} ....
jmxHost is localhost, and jmxPort is 7199 (Cassandra's default), but running netstat doesn't show this port as open.