java.sql.SQLNonTransientConnectionException:org.apache.thrift.transport.TTransportException:帧大小大于最大长度(16384000)!

时间:2014-04-14 08:34:52

标签: java cassandra

我在使用Cassandra DB的IntellyJ中有一个java项目,我使用的是Maven 3和Java 7. Cassandra版本是2.0.6。我有一张近100,000行的表。当我运行程序时,我得到了这个例外:

 java.sql.SQLNonTransientConnectionException: org.apache.thrift.transport.TTransportException: Frame size (16858796) larger than max length (16384000)!
at org.apache.cassandra.cql.jdbc.CassandraStatement.doExecute(CassandraStatement.java:197)
at org.apache.cassandra.cql.jdbc.CassandraStatement.executeQuery(CassandraStatement.java:229)
at ir.categorization.methods.featureselection.DBFeatureSelection.getFeatures(DBFeatureSelection.java:102)
at ir.categorization.methods.test.Classifier.setFeatures(Classifier.java:67)
at ir.categorization.methods.test.Classifier.<init>(Classifier.java:50)
at ir.categorization.methods.test.ClassifierTest.main(ClassifierTest.java:105)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:606)
at com.intellij.rt.execution.application.AppMain.main(AppMain.java:120)
Caused by: org.apache.thrift.transport.TTransportException: Frame size (16858796) larger than max length (16384000)!
at org.apache.thrift.transport.TFramedTransport.readFrame(TFramedTransport.java:137)
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.readAll(TBinaryProtocol.java:362)
at org.apache.thrift.protocol.TBinaryProtocol.readI32(TBinaryProtocol.java:284)
at org.apache.thrift.protocol.TBinaryProtocol.readMessageBegin(TBinaryProtocol.java:191)
at org.apache.thrift.TServiceClient.receiveBase(TServiceClient.java:69)
at org.apache.cassandra.thrift.Cassandra$Client.recv_execute_cql3_query(Cassandra.java:1562)
at org.apache.cassandra.thrift.Cassandra$Client.execute_cql3_query(Cassandra.java:1547)
at org.apache.cassandra.cql.jdbc.CassandraConnection.execute(CassandraConnection.java:468)
at org.apache.cassandra.cql.jdbc.CassandraConnection.execute(CassandraConnection.java:494)
at org.apache.cassandra.cql.jdbc.CassandraStatement.doExecute(CassandraStatement.java:164)
... 10 more
 Exception in thread "main" java.lang.NullPointerException
at java.util.TimSort.sort(TimSort.java:173)
at java.util.Arrays.sort(Arrays.java:659)
at ir.categorization.methods.test.Classifier.setFeatures(Classifier.java:68)
at ir.categorization.methods.test.Classifier.<init>(Classifier.java:50)
at ir.categorization.methods.test.ClassifierTest.main(ClassifierTest.java:105)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:606)
at com.intellij.rt.execution.application.AppMain.main(AppMain.java:120)

我已经在eclipse中使用了带有java 6的cassandra 1.2.8,而且一切都还可以!

P.S:我将cassandra.yaml中的native_transport_max_frame_size_in_mb从256设置为512,将thrift_framed_transport_size_in_mb设置为15到32,但它没有修复。

任何人都可以帮忙吗?

2 个答案:

答案 0 :(得分:1)

请使用Thrift版本0.9.0。

答案 1 :(得分:-1)

将cassandra.yaml中的属性 start_native_transport 更改为

start_native_transport: true

然后尝试确保使用正确的端口进行操作。

您使用哪种API与Cassandra进行互动?