Created 05-10-2016 04:14 AM
I’m having an issue with my Storm topology. Everytime I process the tuple I get the following exception:
Caused by: java.lang.IllegalArgumentException: word does not exist at backtype.storm.tuple.Fields.fieldIndex(Fields.java:78) at backtype.storm.tuple.TupleImpl.fieldIndex(TupleImpl.java:100) at backtype.storm.tuple.TupleImpl.getStringByField(TupleImpl.java:153) at TickFail.WordCounterBolt.execute(WordCounterBolt.java:48) at backtype.storm.daemon.executor$fn__3697$tuple_action_fn__3699.invoke(executor.clj:670) at backtype.storm.daemon.executor$mk_task_receiver$fn__3620.invoke(executor.clj:429) at backtype.storm.disruptor$clojure_handler$reify__3196.onEvent(disruptor.clj:58) at backtype.storm.utils.DisruptorQueue.consumeBatchToCursor(DisruptorQueue.java:125)
I’m not sure whats happening, I think it has something to do with my tick tuple
Here is the code for my execute method in my bolt:
@Override public void execute(Tuple tuple) { String str = tuple.getStringByField("word"); if (isTickTuple(tuple)) { emitCounters(tuple); return; } ..
Here is my tick tuple logic:
@Override public Map<String, Object> getComponentConfiguration() { Config conf = new Config(); conf.put(Config.TOPOLOGY_TICK_TUPLE_FREQ_SECS, 20); return conf; } private boolean isTickTuple(Tuple tuple) { String sourceComponent = tuple.getSourceComponent(); String sourceStreamId = tuple.getSourceStreamId(); return sourceComponent.equals(Constants.SYSTEM_COMPONENT_ID) && sourceStreamId.equals(Constants.SYSTEM_TICK_STREAM_ID); }
Created 05-10-2016 04:17 AM
The error you are getting has to do with the logic in your execute method, particularly:
String str = tuple.getStringByField("word");
The Tick Tuple your bolt receives is mixed in with the other normal tuples you are processing.
You are attempting to get the field with the name “word” before you are checking if the tuple is a Tick Tuple.
The Tick Tuple has 1 field, “rate_secs” that is a equal to the value set for TOPOLOGY_TICK_TUPLE_FREQ_SECS in your conf. When you receive this Tick Tuple, you are attempting to get a field that does not exist, “word”, and assign it to the String, str. This is the reason you get the IllegalArgumentException: word does not exist.
Move
String str = tuple.getStringByField("word");
After your check for the Tick Tuple.
Created 05-10-2016 04:17 AM
The error you are getting has to do with the logic in your execute method, particularly:
String str = tuple.getStringByField("word");
The Tick Tuple your bolt receives is mixed in with the other normal tuples you are processing.
You are attempting to get the field with the name “word” before you are checking if the tuple is a Tick Tuple.
The Tick Tuple has 1 field, “rate_secs” that is a equal to the value set for TOPOLOGY_TICK_TUPLE_FREQ_SECS in your conf. When you receive this Tick Tuple, you are attempting to get a field that does not exist, “word”, and assign it to the String, str. This is the reason you get the IllegalArgumentException: word does not exist.
Move
String str = tuple.getStringByField("word");
After your check for the Tick Tuple.
Created 05-10-2016 04:36 AM
that worked! thanks for the explanation