首页 > 解决方案 > 在 Cassandra 中查询表时出现“ServerError:java.lang.IllegalArgumentException:null”?

问题描述

每当我查询特定表中的任何内容时,都会收到错误“ServerError: java.lang.IllegalArgumentException: null”。

我尝试过的示例查询:

select * from audit;
select * from audit limit 2;
select SPECIFIC_COLUMN from audit WHERE ID = '123456' ALLOW FILTERING;

数据存在:

nodetool cfstats -- keyspace_name.audit
Total number of tables: 55
----------------
Keyspace : keyspace_name
    Read Count: 0
    Read Latency: NaN ms
    Write Count: 0
    Write Latency: NaN ms
    Pending Flushes: 0
        Table: audit
        SSTable count: 2
        Space used (live): 99745
        Space used (total): 99745
        Space used by snapshots (total): 0
        Off heap memory used (total): 1456
        SSTable Compression Ratio: 0.2623552456457625
        Number of partitions (estimate): 900
        Memtable cell count: 0
        Memtable data size: 0
        Memtable off heap memory used: 0
        Memtable switch count: 0
        Local read count: 0
        Local read latency: NaN ms
        Local write count: 0
        Local write latency: NaN ms
        Pending flushes: 0
        Percent repaired: 100.0
        Bloom filter false positives: 0
        Bloom filter false ratio: 0.00000
        Bloom filter space used: 1160

使用 sstabledump 的转储没有什么明显的:

sstabledump /opt/company/data/cassandra/data/keyspace_name/audit-501e5910887811e98345e1aa09bd5db5/mc-1-big-Data.db > test_dump

从运行查询时开始:

/opt/company/data/cassandra/logs/system.log

ERROR [Native-Transport-Requests-1] 2019-08-13 00:34:49,708 ErrorMessage.java:384 - Unexpected exception during request
java.lang.IllegalArgumentException: null
    at java.nio.Buffer.limit(Buffer.java:275) ~[na:1.8.0_162]
    at org.apache.cassandra.utils.ByteBufferUtil.readBytes(ByteBufferUtil.java:620) ~[apache-cassandra-3.11.2.jar:3.11.2]
    at org.apache.cassandra.utils.ByteBufferUtil.readBytesWithShortLength(ByteBufferUtil.java:629) ~[apache-cassandra-3.11.2.jar:3.11.2]
    at org.apache.cassandra.db.marshal.CompositeType.split(CompositeType.java:188) ~[apache-cassandra-3.11.2.jar:3.11.2]
    at org.apache.cassandra.cql3.statements.SelectStatement.getComponents(SelectStatement.java:809) ~[apache-cassandra-3.11.2.jar:3.11.2]
    at org.apache.cassandra.cql3.statements.SelectStatement.processPartition(SelectStatement.java:829) ~[apache-cassandra-3.11.2.jar:3.11.2]
    at org.apache.cassandra.cql3.statements.SelectStatement.process(SelectStatement.java:791) ~[apache-cassandra-3.11.2.jar:3.11.2]
    at org.apache.cassandra.cql3.statements.SelectStatement.processResults(SelectStatement.java:439) ~[apache-cassandra-3.11.2.jar:3.11.2]
    at org.apache.cassandra.cql3.statements.SelectStatement.execute(SelectStatement.java:417) ~[apache-cassandra-3.11.2.jar:3.11.2]
    at org.apache.cassandra.cql3.statements.SelectStatement.execute(SelectStatement.java:290) ~[apache-cassandra-3.11.2.jar:3.11.2]
    at org.apache.cassandra.cql3.statements.SelectStatement.execute(SelectStatement.java:118) ~[apache-cassandra-3.11.2.jar:3.11.2]
    at org.apache.cassandra.cql3.QueryProcessor.processStatement(QueryProcessor.java:224) ~[apache-cassandra-3.11.2.jar:3.11.2]
    at org.apache.cassandra.cql3.QueryProcessor.process(QueryProcessor.java:255) ~[apache-cassandra-3.11.2.jar:3.11.2]
    at org.apache.cassandra.cql3.QueryProcessor.process(QueryProcessor.java:240) ~[apache-cassandra-3.11.2.jar:3.11.2]
    at org.apache.cassandra.transport.messages.QueryMessage.execute(QueryMessage.java:116) ~[apache-cassandra-3.11.2.jar:3.11.2]
    at org.apache.cassandra.transport.Message$Dispatcher.channelRead0(Message.java:517) [apache-cassandra-3.11.2.jar:3.11.2]
    at org.apache.cassandra.transport.Message$Dispatcher.channelRead0(Message.java:410) [apache-cassandra-3.11.2.jar:3.11.2]
    at io.netty.channel.SimpleChannelInboundHandler.channelRead(SimpleChannelInboundHandler.java:105) [netty-all-4.0.44.Final.jar:4.0.44.Final]
    at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:357) [netty-all-4.0.44.Final.jar:4.0.44.Final]
    at io.netty.channel.AbstractChannelHandlerContext.access$600(AbstractChannelHandlerContext.java:35) [netty-all-4.0.44.Final.jar:4.0.44.Final]
    at io.netty.channel.AbstractChannelHandlerContext$7.run(AbstractChannelHandlerContext.java:348) [netty-all-4.0.44.Final.jar:4.0.44.Final]
    at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511) [na:1.8.0_162]
    at org.apache.cassandra.concurrent.AbstractLocalAwareExecutorService$FutureTask.run(AbstractLocalAwareExecutorService.java:162) [apache-cassandra-3.11.2.jar:3.11.2]
    at org.apache.cassandra.concurrent.SEPWorker.run(SEPWorker.java:109) [apache-cassandra-3.11.2.jar:3.11.2]
    at java.lang.Thread.run(Thread.java:748) [na:1.8.0_162]

/var/log/messages 中没有任何内容。

/var/log/cassandra/cassandra.log 的启动中没有任何内容。

nodetool repair, nodetool repair --trace entpor_access audit(修复中没有问题,它成功完成,重新启动节点,它存在于所有副本中,没有可用的备份并且不确定如何恢复。

标签: cassandranosqldatastax-enterprisecqlsh

解决方案


我很确定 IllegalArgumentException 意味着您没有正确编写函数调用或忘记在函数调用中指定参数。虽然我在 Java 领域不是特别有经验,但请查看 Cassandra 的文档,看看您的代码中是否缺少参数。


推荐阅读