views:

44

answers:

2

When I try to connect to cassandra within my java application I receive the exception at the end of this message. I am using pelops library to access database. Database is working on linux and my development environment is on windos 7. Intresting line is

WARNING: 10.0.0.7 NodeContext killing all pooled connections for session 44

10.0.0.7 is the IP of the cassandra node. And I can connect this node with cassandra-cli. After a few hours of googling I decided to ask, what i am doing wrong? Complete stack trace is below.

SEVERE: org.apache.thrift.transport.TTransportException: java.net.ConnectException: Connection refused: connect at org.apache.thrift.transport.TSocket.open(TSocket.java:185) at org.wyki.cassandra.pelops.ThriftPool$Connection.open(ThriftPool.java:329) at org.wyki.cassandra.pelops.ThriftPool$NodeContext.createConnection(ThriftPool.java:438) at org.wyki.cassandra.pelops.ThriftPool$NodeContext.access$5(ThriftPool.java:429) at org.wyki.cassandra.pelops.ThriftPool$NodeContext$1.run(ThriftPool.java:494) at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908) at java.lang.Thread.run(Thread.java:619) Caused by: java.net.ConnectException: Connection refused: connect at java.net.PlainSocketImpl.socketConnect(Native Method) at java.net.PlainSocketImpl.doConnect(PlainSocketImpl.java:333) at java.net.PlainSocketImpl.connectToAddress(PlainSocketImpl.java:195) at java.net.PlainSocketImpl.connect(PlainSocketImpl.java:182) at java.net.SocksSocketImpl.connect(SocksSocketImpl.java:366) at java.net.Socket.connect(Socket.java:529) at java.net.Socket.connect(Socket.java:478) at org.apache.thrift.transport.TSocket.open(TSocket.java:180) ... 7 more

WARNING: 10.0.0.7 NodeContext killing all pooled connections for session 44

+1  A: 

"Connection refused" means that Cassandra isn't listening on the interface you're connecting to. By default Cassandra listens on port 9160 on localhost. You will need to change that if you want to connect externally; read the comments for ThriftAddress in the configuration file.

jbellis
it is listening on 9160, an host 0.0.0.0 and I can connect it with cassandra-cli from a remote machine.So this is not the problem.
Deniz
A: 

It seems that this is a problem with pelops, which is a library on top of cassandra's thrift client. It has some problems for connection to Cassandra working on linux and client on a windows machine.

Deniz