java.lang.IllegalArgumentException: message does not exist

2017-03-24 09:38:30   作者:MangoCool   来源:MangoCool

storm-0.9.6将处理后的数据写入kafka,出现报错:java.lang.IllegalArgumentException: message does not exist。

详细信息如下:

19691 [Thread-59-kafka-producer-spout] ERROR backtype.storm.daemon.executor - 
java.lang.IllegalArgumentException: message does not exist
at backtype.storm.tuple.Fields.fieldIndex(Fields.java:78) ~[storm-core-0.9.6.jar:0.9.6]
at backtype.storm.tuple.TupleImpl.fieldIndex(TupleImpl.java:100) ~[storm-core-0.9.6.jar:0.9.6]
at backtype.storm.tuple.TupleImpl.getValueByField(TupleImpl.java:149) ~[storm-core-0.9.6.jar:0.9.6]
at storm.kafka.bolt.mapper.FieldNameBasedTupleToKafkaMapper.getMessageFromTuple(FieldNameBasedTupleToKafkaMapper.java:46) ~[storm-kafka-0.9.6.jar:0.9.6]
at storm.kafka.bolt.KafkaBolt.execute(KafkaBolt.java:97) ~[storm-kafka-0.9.6.jar:0.9.6]
at backtype.storm.daemon.executor$fn__3439$tuple_action_fn__3441.invoke(executor.clj:640) [storm-core-0.9.6.jar:0.9.6]
at backtype.storm.daemon.executor$mk_task_receiver$fn__3362.invoke(executor.clj:407) [storm-core-0.9.6.jar:0.9.6]
at backtype.storm.disruptor$clojure_handler$reify__1445.onEvent(disruptor.clj:58) [storm-core-0.9.6.jar:0.9.6]
at backtype.storm.utils.DisruptorQueue.consumeBatchToCursor(DisruptorQueue.java:132) [storm-core-0.9.6.jar:0.9.6]
at backtype.storm.utils.DisruptorQueue.consumeBatchWhenAvailable(DisruptorQueue.java:106) [storm-core-0.9.6.jar:0.9.6]
at backtype.storm.disruptor$consume_batch_when_available.invoke(disruptor.clj:80) [storm-core-0.9.6.jar:0.9.6]
at backtype.storm.daemon.executor$fn__3439$fn__3451$fn__3498.invoke(executor.clj:755) [storm-core-0.9.6.jar:0.9.6]
at backtype.storm.util$async_loop$fn__460.invoke(util.clj:463) [storm-core-0.9.6.jar:0.9.6]
at clojure.lang.AFn.run(AFn.java:24) [clojure-1.5.1.jar:na]
at java.lang.Thread.run(Thread.java:745) [na:1.8.0_121]

解决方法:

将storm最后一个bolt的outputFieldsDeclarer中Field名改成"message",如下:

public void declareOutputFields(OutputFieldsDeclarer outputFieldsDeclarer) {
        outputFieldsDeclarer.declare(new Fields("message"));
}

即可!

标签: storm、kafka

分享:

关于我

一个喜欢唱歌,热衷旅行,爱好电子产品的码农。没事,跟三五好友吼上几嗓子,约上几个背着行囊去露营或者宅在家里抱着孩子敲代码。

座右铭:当你的才华还撑不起你的野心的时候,你就应该静下心来学习,永不止步!

            人生之旅历途甚长,所争决不在一年半月,万不可因此着急失望,招精神之萎葸。


Copyright 芒果酷(mangocool.com) All rights reserved. 湘ICP备14019394号

免责声明:本网站部分文章转载其他媒体,意在为公众提供免费服务。如有信息侵犯了您的权益,可与本网站联系,本网站将尽快予以撤除。