SnehaT
SnehaT

Reputation: 309

org.apache.thrift.transport.TTransportException: Read a negative frame size (-2080374784)!

I am trying to connect to Cassandra DB using JDBC driver:

Class.forName("org.apache.cassandra.cql.jdbc.CassandraDriver");
Connection con = DriverManager.getConnection("jdbc:cassandra://10.11.15.242:9042/edgeview");

I am unable to connect to Cassandra. It always give below errors:

org.apache.thrift.transport.TTransportException: Read a negative frame size (-2080374784)!

I have added below Libraries:

Cassandra-jdbc-1.2.5.jar
Cassandra-thrift-1.2.6.jar
Cassandra-clientutil-1.2.6.jar
libthrift-0.9.0.jar

Any help would be appreciated.

Upvotes: 5

Views: 6448

Answers (1)

Aaron
Aaron

Reputation: 57748

DriverManager.getConnection("jdbc:cassandra://10.11.15.242:9042/edgeview");

So 9042 is the port for the native binary protocol connection, and 9160 is for Thrift.

You need to figure out if you are connecting via Thrift or Native, and use the appropriate port. Given your error message, it sounds like JDBC Cassandra uses Thrift, so you may need to specify 9160 as your port.

Of course, connecting via Thrift has been deprecated, and is even disabled by default in Cassandra 2.2+.

Upvotes: 6

Related Questions