8

I'm experiencing this error while trying to query Cassandra using cassandra-jdbc(1.1.3) driver.

Caused by: org.apache.thrift.transport.TTransportException: Read a negative frame size (-2147418110)!
at org.apache.thrift.transport.TFramedTransport.readFrame(TFramedTransport.java:133)
at org.apache.thrift.transport.TFramedTransport.read(TFramedTransport.java:101)
at org.apache.thrift.transport.TTransport.readAll(TTransport.java:84)
at org.apache.thrift.protocol.TBinaryProtocol.readStringBody(TBinaryProtocol.java:354)
at org.apache.thrift.protocol.TBinaryProtocol.readMessageBegin(TBinaryProtocol.java:215)
at org.apache.thrift.TServiceClient.receiveBase(TServiceClient.java:69)
at org.apache.cassandra.thrift.Cassandra$Client.recv_prepare_cql_query(Cassandra.java:1438)
at org.apache.cassandra.thrift.Cassandra$Client.prepare_cql_query(Cassandra.java:1424)
at org.apache.cassandra.cql.jdbc.CassandraConnection.prepare(CassandraConnection.java:438)
at org.apache.cassandra.cql.jdbc.CassandraConnection.prepare(CassandraConnection.java:452)
at org.apache.cassandra.cql.jdbc.CassandraPreparedStatement.<init>(CassandraPreparedStatement.java:85)
... 79 more

This is my sample code snippet

statement = connection.prepareStatement(SELECT_CQL);
statement.setString(1, ID);
resultSet = statement.executeQuery();
Martin Schröder
  • 4,176
  • 7
  • 47
  • 81
udarakr
  • 536
  • 2
  • 6
  • 18
  • Maybe your client is not using framed transport? How did you make the connection object? – Richard Apr 23 '14 at 18:33
  • Since we are using CQL I wonder how this thrift interface comes in to the picture.. – udarakr Apr 23 '14 at 19:06
  • I am facing a similar problem connecting Cassandra in my web application. I am using Play! 2.4 and Cassandra 2.2 versions respectively. All of the things in my persistence.xml are provided perfectly. The only thing I am little unsure of is what to write inside the persistence_unit attribute in persistence.xml ? The exception I get is `org.apache.thrift.TException: org.apache.thrift.transport.TTransportException: Read a negative frame size (-2080374784)!`. If someone can help regarding this ? – Vinit Sharma Dec 16 '15 at 05:25

1 Answers1

10

I'm supposing you were trying to connect to Cassandra via JDBC on cql port (9042). I was able to connect to it enabling thrift with

nodetool enablethrift

and then connecting to port 9160 (or whichever you might have overriden in conf/cassandra.yaml). Hope this helps.

Perry Cox
  • 101
  • 1
  • 3