Creating a new CassandraClientOptions for another instance doesn't work
Closed this issue · 0 comments
mafa73 commented
Version
3.8.5
Context
It isn't possible to create a new CassandraClientOptions instance base on another CassandraClientOptions instance if the addContactPoints has been used on the original.
Do you have a reproducer?
public static void main(String[] args) {
Vertx vertx = Vertx.vertx();
try {
CassandraClientOptions cassandraClientOptions = new CassandraClientOptions().addContactPoint("127.0.0.1");
CassandraClientOptions cassandraClientOptionsCopy = new CassandraClientOptions(cassandraClientOptions);
} finally {
vertx.close();
}
}
Exception is thrown when cassandraClientOptionsCopy is created:
Exception in thread "main" java.lang.IllegalArgumentException: Failed to add contact point: /127.0.0.1:9042
at com.datastax.driver.core.Cluster$Builder.addContactPoint(Cluster.java:900)
at io.vertx.cassandra.CassandraClientOptions.setContactPoints(CassandraClientOptions.java:100)
at io.vertx.cassandra.CassandraClientOptions.<init>(CassandraClientOptions.java:62)
Caused by: java.net.UnknownHostException: /127.0.0.1:9042: nodename nor servname provided, or not known
at java.base/java.net.Inet6AddressImpl.lookupAllHostAddr(Native Method)
at java.base/java.net.InetAddress$PlatformNameService.lookupAllHostAddr(InetAddress.java:930)
at java.base/java.net.InetAddress.getAddressesFromNameService(InetAddress.java:1499)
at java.base/java.net.InetAddress$NameServiceAddresses.get(InetAddress.java:849)
at java.base/java.net.InetAddress.getAllByName0(InetAddress.java:1489)
at java.base/java.net.InetAddress.getAllByName(InetAddress.java:1348)
at java.base/java.net.InetAddress.getAllByName(InetAddress.java:1282)
at com.datastax.driver.core.Cluster$Builder.addContactPoint(Cluster.java:897)
... 3 more
Steps to reproduce
- Run the code above
Extra
- Same error on Mac OS and in Docker image based on Cent OS