<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>question Re: Storm Bolt throws an error when trying to read a field from a tuple in Archives of Support Questions (Read Only)</title>
    <link>https://community.cloudera.com/t5/Archives-of-Support-Questions/Storm-Bolt-throws-an-error-when-trying-to-read-a-field-from/m-p/139552#M27785</link>
    <description>&lt;P&gt;that worked! thanks for the explanation&lt;/P&gt;</description>
    <pubDate>Tue, 10 May 2016 11:36:03 GMT</pubDate>
    <dc:creator>Alex_hardingrnd</dc:creator>
    <dc:date>2016-05-10T11:36:03Z</dc:date>
    <item>
      <title>Storm Bolt throws an error when trying to read a field from a tuple</title>
      <link>https://community.cloudera.com/t5/Archives-of-Support-Questions/Storm-Bolt-throws-an-error-when-trying-to-read-a-field-from/m-p/139550#M27783</link>
      <description>&lt;P&gt;I’m having an issue with my Storm topology. Everytime I process the tuple I get the following exception:&lt;/P&gt;&lt;PRE&gt;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)
&lt;/PRE&gt;&lt;P&gt;I’m not sure whats happening, I think it has something to do with my tick tuple&lt;/P&gt;&lt;P&gt;Here is the code for my execute method in my bolt:&lt;/P&gt;&lt;PRE&gt;@Override
public void execute(Tuple tuple) {
String str = tuple.getStringByField("word");
if (isTickTuple(tuple)) {
emitCounters(tuple);
return;
}
..
&lt;/PRE&gt;&lt;P&gt;Here is my tick tuple logic:&lt;/P&gt;&lt;PRE&gt;@Override
public Map&amp;lt;String, Object&amp;gt; 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)
&amp;amp;&amp;amp; sourceStreamId.equals(Constants.SYSTEM_TICK_STREAM_ID);
}&lt;/PRE&gt;</description>
      <pubDate>Tue, 10 May 2016 11:14:47 GMT</pubDate>
      <guid>https://community.cloudera.com/t5/Archives-of-Support-Questions/Storm-Bolt-throws-an-error-when-trying-to-read-a-field-from/m-p/139550#M27783</guid>
      <dc:creator>Alex_hardingrnd</dc:creator>
      <dc:date>2016-05-10T11:14:47Z</dc:date>
    </item>
    <item>
      <title>Re: Storm Bolt throws an error when trying to read a field from a tuple</title>
      <link>https://community.cloudera.com/t5/Archives-of-Support-Questions/Storm-Bolt-throws-an-error-when-trying-to-read-a-field-from/m-p/139551#M27784</link>
      <description>&lt;P&gt;The error you are getting has to do with the logic in your execute method, particularly:&lt;/P&gt;&lt;PRE&gt;String str = tuple.getStringByField("word");&lt;/PRE&gt;&lt;P&gt;The Tick Tuple your bolt receives is mixed in with the other normal tuples you are processing.&lt;/P&gt;&lt;P&gt;You are attempting to get the field with the name “word” before you are checking if the tuple is a Tick Tuple.&lt;/P&gt;&lt;P&gt;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.&lt;/P&gt;&lt;P&gt;Move &lt;/P&gt;&lt;PRE&gt;String str = tuple.getStringByField("word");&lt;/PRE&gt;&lt;P&gt;After your check for the Tick Tuple.&lt;/P&gt;</description>
      <pubDate>Tue, 10 May 2016 11:17:32 GMT</pubDate>
      <guid>https://community.cloudera.com/t5/Archives-of-Support-Questions/Storm-Bolt-throws-an-error-when-trying-to-read-a-field-from/m-p/139551#M27784</guid>
      <dc:creator>nismaily</dc:creator>
      <dc:date>2016-05-10T11:17:32Z</dc:date>
    </item>
    <item>
      <title>Re: Storm Bolt throws an error when trying to read a field from a tuple</title>
      <link>https://community.cloudera.com/t5/Archives-of-Support-Questions/Storm-Bolt-throws-an-error-when-trying-to-read-a-field-from/m-p/139552#M27785</link>
      <description>&lt;P&gt;that worked! thanks for the explanation&lt;/P&gt;</description>
      <pubDate>Tue, 10 May 2016 11:36:03 GMT</pubDate>
      <guid>https://community.cloudera.com/t5/Archives-of-Support-Questions/Storm-Bolt-throws-an-error-when-trying-to-read-a-field-from/m-p/139552#M27785</guid>
      <dc:creator>Alex_hardingrnd</dc:creator>
      <dc:date>2016-05-10T11:36:03Z</dc:date>
    </item>
  </channel>
</rss>

