cassandra-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Vadim TSes'ko (JIRA)" <j...@apache.org>
Subject [jira] [Comment Edited] (CASSANDRA-12454) Unable to start on IPv6-only node with local JMX
Date Sat, 13 Aug 2016 15:55:20 GMT

    [ https://issues.apache.org/jira/browse/CASSANDRA-12454?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15419969#comment-15419969
] 

Vadim TSes'ko edited comment on CASSANDRA-12454 at 8/13/16 3:54 PM:
--------------------------------------------------------------------

The patch:
{code:java}
diff --git a/src/java/org/apache/cassandra/utils/JMXServerUtils.java b/src/java/org/apache/cassandra/utils/JMXServerUtils.java
index ad87efd..e420600 100644
--- a/src/java/org/apache/cassandra/utils/JMXServerUtils.java
+++ b/src/java/org/apache/cassandra/utils/JMXServerUtils.java
@@ -22,6 +22,8 @@ import java.io.IOException;
 import java.lang.management.ManagementFactory;
 import java.lang.reflect.InvocationHandler;
 import java.lang.reflect.Proxy;
+import java.net.Inet4Address;
+import java.net.Inet6Address;
 import java.net.InetAddress;
 import java.rmi.NoSuchObjectException;
 import java.rmi.Remote;
@@ -76,7 +78,18 @@ public class JMXServerUtils
         // Configure the RMI client & server socket factories, including SSL config.
         env.putAll(configureJmxSocketFactories(serverAddress));

-        String url = String.format(urlTemplate, (serverAddress != null ? serverAddress.getHostAddress()
: "0.0.0.0"), port);
+        final String hostAddress;
+        if (serverAddress == null) {
+            hostAddress = "0.0.0.0";
+        } else if (serverAddress instanceof Inet4Address) {
+            hostAddress = serverAddress.getHostAddress();
+        } else if (serverAddress instanceof Inet6Address) {
+            hostAddress = '[' + serverAddress.getHostAddress() + ']';
+        } else {
+            throw new UnsupportedOperationException("Unsupported InetAddress");
+        }
+
+        String url = String.format(urlTemplate, hostAddress, port);
         LocateRegistry.createRegistry(port,
                                      (RMIClientSocketFactory) env.get(RMIConnectorServer.RMI_CLIENT_SOCKET_FACTORY_ATTRIBUTE),
                                      (RMIServerSocketFactory) env.get(RMIConnectorServer.RMI_SERVER_SOCKET_FACTORY_ATTRIBUTE));
{code}
And the result in {{LOCAL_JMX}} mode:
{code}
INFO  [main] 2016-08-13 18:51:36,511 JMXServerUtils.java:121 - Configured JMX server at: service:jmx:rmi://[0:0:0:0:0:0:0:1]/jndi/rmi://[0:0:0:0:0:0:0:1]:7199/jmxrmi
{code}


was (Author: incubos):
I can prepare a pull request, if it helps.

> Unable to start on IPv6-only node with local JMX
> ------------------------------------------------
>
>                 Key: CASSANDRA-12454
>                 URL: https://issues.apache.org/jira/browse/CASSANDRA-12454
>             Project: Cassandra
>          Issue Type: Bug
>         Environment: Ubuntu Trusty, Oracle JDK 1.8.0_102-b14, IPv6-only host
>            Reporter: Vadim TSes'ko
>
> A Cassandra node using *default* configuration is unable to start on *IPv6-only* machine
with the following error message:
> {code}
> ERROR [main] 2016-08-13 14:38:07,309 CassandraDaemon.java:731 - Bad URL path: :0:0:0:0:0:1/jndi/rmi://0:0:0:0:0:0:0:1:7199/jmxrmi
> {code}
> The problem might be located in {{JMXServerUtils.createJMXServer()}} (I am not sure,
because there is no stack trace in {{system.log}}):
> {code:java}
> String urlTemplate = "service:jmx:rmi://%1$s/jndi/rmi://%1$s:%2$d/jmxrmi";
> ...
> String url = String.format(urlTemplate, (serverAddress != null ? serverAddress.getHostAddress()
: "0.0.0.0"), port);
> {code}
> IPv6 addresses must be surrounded by square brackets when passed to {{JMXServiceURL}}.
> Disabling {{LOCAL_JMX}} mode in {{cassandra-env.sh}} (and enabling JMX authentication)
helps.



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

Mime
View raw message