6

I have a java API application which connects to cassandra instance. My cassandra instance is hosted on google cloud platform. When I run the program in my IDE, it works fine and is able to connect to the cassandra instance. However when I deploy the application in a docker container I am getting the following error

com.datastax.driver.core.exceptions.NoHostAvailableException: All host(s) tried for query failed (tried: /104.X.X.X:9042 (com.datastax.driver.core.exceptions.TransportException: [/104.X.X.X:9042] Error writing

From inside the container, I am able to ping the Cassandra instance. Most of the error I have seen on google end with "Connection closed" or "Channel closed" or "Cannot connect". However this one ends with "Error writing", can someone please help me troubleshoot this issue.

zakSyed
  • 1,364
  • 1
  • 13
  • 30
  • Do you have logs from Cassandra itself? – Alex Ott May 11 '18 at 06:49
  • Its not even reaching cassandra and timing out in the container. I think this might be because of the java version. I have oracle java on my machine and I have openJDK in the container, thats the only difference. I will test that out and update everyone if that works. – zakSyed May 11 '18 at 14:08
  • It shouldn't be a problem. If it timeouts in container, maybe there firewalls between? – Alex Ott May 11 '18 at 14:11
  • I tried with oracle jdk and it did not work. @AlexOtt all the outbound connection from docker container are open so how there be a firewall – zakSyed May 12 '18 at 05:06
  • I would recommend to perform capture of network traffic and see what happens – Alex Ott May 12 '18 at 19:40
  • I have the exact same problem, I'm trying to diagnose it right now. I have a quite small range of commits that broke it so I'll probably come back with a solution soon :) – user3711864 Aug 06 '18 at 09:34
  • Guys, any progress in this??? @user3711864 did you find a solution? – yaroska Feb 05 '19 at 10:21
  • I have this same problem too. I can connect from DataGrip but not from the app due to this error. My previous error is also `TransportException` but that was because I forgot to provide path to the truststore file. After I add it, still `TransportException` but I notice the "Error Writing". Does this mean it can reach cassandra but no write permission? – alltej Oct 09 '20 at 13:56

0 Answers0