HiveBrain v1.2.0
Get Started
← Back to all entries
patternjavaMinor

nodetool with Java 8u331 returns "URISyntaxException: 'Malformed IPv6 address at index 7: rmi://[127.0.0.1]:7199'"

Submitted by: @import:stackexchange-dba··
0
Viewed 0 times
addressrmiwith8u331nodetool127javaurisyntaxexception7199returns

Problem

Why does running nodetool return the following exception?

nodetool: Failed to connect to '127.0.0.1:7199' - \
  URISyntaxException: 'Malformed IPv6 address at index 7: rmi://[127.0.0.1]:7199'.


This question is commonly reported by Cassandra users after upgrading Java on servers.

Solution

Root cause

The URL parser for JNDI providers which includes RMI (used by JMX) has been improved in Oracle Java 8u331 and brackets are only allowed around IPv6 addresses (JDK-8278972).

Attempts to run nodetool with newer Java versions breaks because the host in the RMI URL is enclosed in square brackets (from NodeProbe.java class):

private static final String fmtUrl = "service:jmx:rmi:///jndi/rmi://[%s]:%d/jmxrmi";


Workarounds

OPTION 1 - Add the "legacy" parsing flag when running nodetool, for example:

$ nodetool -Dcom.sun.jndi.rmiURLParsing=legacy status


OPTION 2 - Specify the hostname with an IPv6 subnet prefix, for example:

$ nodetool -h ::FFFF:127.0.0.1 status


Solution

This issue has been addressed in Apache Cassandra 3.0.27, 3.11.13, 4.0.4 and 4.1 releases (CASSANDRA-17581).

Upgrade to the latest patch release to fix the issue in your cluster. Cheers!

Republished from DataStax Community.

Please support the Apache Cassandra community by hovering over cassandra then click on the Watch tag button. Thanks!

Code Snippets

private static final String fmtUrl = "service:jmx:rmi:///jndi/rmi://[%s]:%d/jmxrmi";
$ nodetool -Dcom.sun.jndi.rmiURLParsing=legacy status
$ nodetool -h ::FFFF:127.0.0.1 status

Context

StackExchange Database Administrators Q#315761, answer score: 4

Revisions (0)

No revisions yet.