Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

Tags:

java

cassandra

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.

like image 987
SnehaT Avatar asked Aug 12 '16 12:08

SnehaT


1 Answers

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+.

like image 76
Aaron Avatar answered Oct 08 '22 08:10

Aaron