gpt4 book ai didi

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

转载 作者:塔克拉玛干 更新时间:2023-11-01 23:06:33 30 4
gpt4 key购买 nike

我正在尝试使用 JDBC 驱动程序连接到 Cassandra DB:

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

我无法连接到 Cassandra。它总是给出以下错误:

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

我添加了以下库:

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

如有任何帮助,我们将不胜感激。

最佳答案

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

所以 9042 是 native 二进制协议(protocol)连接的端口,9160 是 Thrift 的端口。

您需要弄清楚您是通过 Thrift 还是 Native 进行连接,并使用适当的端口。鉴于您的错误消息,听起来 JDBC Cassandra 使用 Thrift,因此您可能需要指定 9160 作为您的端口。

当然,通过 Thrift 连接已被弃用,甚至在 Cassandra 2.2+ 中默认禁用。

关于java - 组织.apache.thrift.transport.TTransportException : Read a negative frame size (-2080374784)!,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/38918292/

30 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com