Hi there,

I have ipv6 only cassandra cluster, and I'm trying to connect to it using
java driver, like:

Inet6Address inet6 = (Inet6Address)
InetAddress.getByName("2401:db00:0011:60ed:face:0000:0031:0000");
cluster = Cluster.builder().addContactPointsWithPorts(Arrays.asList(new
InetSocketAddress(inet6, 9042))).build();
session = cluster.connect(CASSANDRA_KEYSPACE);

But it failed to connect to the cassandra, looks like the java driver does
not parse the ipv6 address correctly, exceptions are:

337 [cluster1-nio-worker-0] DEBUG com.datastax.driver.core.Connection  -
Connection[/2401:db00:11:60ed:face:0:31:0:9042-1, inFlight=0, closed=true]
closing connection
339 [main] DEBUG com.datastax.driver.core.ControlConnection  - [Control
connection] error on /2401:db00:11:60ed:face:0:31:0:9042 connection, no
more host to try
com.datastax.driver.core.TransportException:
[/2401:db00:11:60ed:face:0:31:0:9042] Cannot connect
        at
com.datastax.driver.core.Connection$1.operationComplete(Connection.java:156)
        at
com.datastax.driver.core.Connection$1.operationComplete(Connection.java:139)
        at
io.netty.util.concurrent.DefaultPromise.notifyListener0(DefaultPromise.java:680)
        at
io.netty.util.concurrent.DefaultPromise.notifyListeners0(DefaultPromise.java:603)
        at
io.netty.util.concurrent.DefaultPromise.notifyListeners(DefaultPromise.java:563)
        at
io.netty.util.concurrent.DefaultPromise.tryFailure(DefaultPromise.java:424)
        at
io.netty.channel.nio.AbstractNioChannel$AbstractNioUnsafe.fulfillConnectPromise(AbstractNioChannel.java:268)
        at
io.netty.channel.nio.AbstractNioChannel$AbstractNioUnsafe.finishConnect(AbstractNioChannel.java:284)
        at
io.netty.channel.nio.NioEventLoop.processSelectedKey(NioEventLoop.java:528)
        at
io.netty.channel.nio.NioEventLoop.processSelectedKeysOptimized(NioEventLoop.java:468)
        at
io.netty.channel.nio.NioEventLoop.processSelectedKeys(NioEventLoop.java:382)
        at io.netty.channel.nio.NioEventLoop.run(NioEventLoop.java:354)
        at
io.netty.util.concurrent.SingleThreadEventExecutor$2.run(SingleThreadEventExecutor.java:111)
        at java.lang.Thread.run(Thread.java:744)
Caused by: java.net.ConnectException: Connection refused:
/2401:db00:11:60ed:face:0:31:0:9042
        at sun.nio.ch.SocketChannelImpl.checkConnect(Native Method)
        at
sun.nio.ch.SocketChannelImpl.finishConnect(SocketChannelImpl.java:735)
        at
io.netty.channel.socket.nio.NioSocketChannel.doFinishConnect(NioSocketChannel.java:224)
        at
io.netty.channel.nio.AbstractNioChannel$AbstractNioUnsafe.finishConnect(AbstractNioChannel.java:281)
        ... 6 more
342 [main] DEBUG com.datastax.driver.core.AbstractReconnectionHandler  -
First reconnection scheduled in 1000ms
342 [main] DEBUG com.datastax.driver.core.AbstractReconnectionHandler  -
Becoming the active handler
342 [main] DEBUG com.datastax.driver.core.Cluster  - Shutting down
Exception in thread "main"
com.datastax.driver.core.exceptions.NoHostAvailableException: All host(s)
tried for query failed (tried: /2401:db00:11:60ed:face:0:31:0:9042
(com.datastax.driver.core.TransportException:
[/2401:db00:11:60ed:face:0:31:0:9042] Cannot connect))
        at
com.datastax.driver.core.ControlConnection.reconnectInternal(ControlConnection.java:223)
        at
com.datastax.driver.core.ControlConnection.connect(ControlConnection.java:78)
        at com.datastax.driver.core.Cluster$Manager.init(Cluster.java:1272)
        at com.datastax.driver.core.Cluster.init(Cluster.java:158)
        at com.datastax.driver.core.Cluster.connect(Cluster.java:248)
        at com.datastax.driver.core.Cluster.connect(Cluster.java:281)

-- 
Dikang

Reply via email to