I am trying to use a Thrift client on JRuby 1.7.3. The error message is always
Could not connect to ::1:55674: Connection refused - Connection refused
I can always connect successfully on ruby-1.9.3. After much Googling, it appears that the Thrift client had an issue with JRuby, but it's supposed to be fixed in 1.6.7.
How should I fix this? Is this a known issue?
Found it!
I was creating my Thrift::ServerSocket
using ::1
. MRI clients will work with this (doesn't matter if host is set to localhost
, ::1
, or 127.0.0.1
. JRuby clients will not, and will complain about refused connections.
Next, I was creating my Thrift::Client
using ::1
. Again, JRuby doesn't like it.
Changing every thing to localhost
fixed it. I don't really understand what is going on, but java is clearly using IPv6.
>lsof -i :56990
COMMAND PID USER FD TYPE SIZE/OFF NODE NAME
java 4441 codex 31u IPv6 0t0 TCP localhost:56990 (LISTEN)
java 4441 codex 36u IPv6 0t0 TCP localhost:56990->localhost:50439 (ESTABLISHED)
java 4875 codex 31u IPv6 0t0 TCP localhost:50439->localhost:56990 (ESTABLISHED)