我在尝试使用cassandra-jdbc(1.1.3)驱动程序查询Cassandra时遇到此错误。
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
这是我的示例代码段
statement = connection.prepareStatement(SELECT_CQL);
statement.setString(1, ID);
resultSet = statement.executeQuery();
答案 0 :(得分:9)
我假设你在cql port(9042)上尝试通过JDBC连接到Cassandra。 我能够通过
连接到它来实现节俭nodetool enablethrift
然后连接到端口9160(或者您可能在conf / cassandra.yaml中覆盖的那个)。希望这会有所帮助。