title: Apache Storm: InvalidTopologyException(msg:Component: [x] subscribes from non-existent component [y]
body: <p>I've used the code from <a href="http://wpcertification.blogspot.in/2014/02/helloworld-apache-storm-word-counter.html" rel="nofollow">this blog</a> (which works fine):  </p>
  
  <pre><code>TopologyBuilder builder = new TopologyBuilder();
  builder.setSpout("line-reader-spout", new LineReaderSpout());
  builder.setBolt("word-spitter", new WordSpitterBolt()).shuffleGrouping("line-reader-spout");
  builder.setBolt("word-counter", new WordCounterBolt()).shuffleGrouping("word-spitter");
  
  LocalCluster cluster = new LocalCluster();
  cluster.submitTopology("HelloStorm", config, builder.createTopology());
  </code></pre>
  
  <p>But when I tweak it to have two spouts which read lines, send the lines to two <code>word-spitter</code> bolts and finally send the results to a single <code>word-counter</code> bolt, the exception of an invalid topology is thrown.  </p>
  
  <p>My tweaked code</p>
  
  <pre><code>TopologyBuilder builder = new TopologyBuilder();
  
  builder.setSpout("line-reader-spout", new LineReaderSpout());
  builder.setSpout("line-reader-spout2", new LineReaderSpout());        
  builder.setBolt("word-spitter", new WordSpitterBolt()).shuffleGrouping("line-reader-spout");
  builder.setBolt("word-spitter2", new WordSpitterBolt()).shuffleGrouping("line-reader-spout2");
  builder.setBolt("word-counter", new WordCounterBolt(),2).shuffleGrouping("word-spitter").shuffleGrouping("word-splitter2");
  LocalCluster cluster = new LocalCluster();
  cluster.submitTopology("HelloStorm", config, builder.createTopology());
  </code></pre>
  
  <p>What is wrong about the topology? I don't see any improper flow. How can <code>word-spitter2</code> be non existent when it is actually created? </p>
  
  <blockquote>
    <p>6661 [main] INFO  b.s.d.nimbus - [req 1] Access from:  principal:
    op:submitTopology 6718 [main] WARN  b.s.d.nimbus - Topology submission
    exception. (topology name='HelloStorm') #InvalidTopologyException
    InvalidTopologyException(msg:Component: [word-counter] subscribes from
    non-existent component [word-splitter2]) 6721 [main] ERROR
    o.a.s.s.o.a.z.s.NIOServerCnxnFactory - Thread Thread[main,5,main] died
    backtype.storm.generated.InvalidTopologyException     at
    backtype.storm.daemon.common$validate_structure_BANG_.invoke(common.clj:160)
    ~[storm-core-0.10.0.jar:0.10.0]   at
    backtype.storm.daemon.common$system_topology_BANG_.invoke(common.clj:299)
    ~[storm-core-0.10.0.jar:0.10.0]   at
    backtype.storm.daemon.nimbus$fn__6583$exec_fn__1236__auto__$reify__6598.submitTopologyWithOpts(nimbus.clj:1091)
    ~[storm-core-0.10.0.jar:0.10.0]   at
    backtype.storm.daemon.nimbus$fn__6583$exec_fn__1236__auto__$reify__6598.submitTopology(nimbus.clj:1119)
    ~[storm-core-0.10.0.jar:0.10.0]   at
    sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    ~[?:1.8.0_73]     at
    sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
    ~[?:1.8.0_73]     at
    sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    ~[?:1.8.0_73]     at java.lang.reflect.Method.invoke(Method.java:497)
    ~[?:1.8.0_73]     at
    clojure.lang.Reflector.invokeMatchingMethod(Reflector.java:93)
    ~[clojure-1.6.0.jar:?]    at
    clojure.lang.Reflector.invokeInstanceMethod(Reflector.java:28)
    ~[clojure-1.6.0.jar:?]    at
    backtype.storm.testing$submit_local_topology.invoke(testing.clj:276)
    ~[storm-core-0.10.0.jar:0.10.0]   at
    backtype.storm.LocalCluster$_submitTopology.invoke(LocalCluster.clj:43)
    ~[storm-core-0.10.0.jar:0.10.0]   at
    backtype.storm.LocalCluster.submitTopology(Unknown Source)
    ~[storm-core-0.10.0.jar:0.10.0]   at
    com.spnotes.storm.HelloStorm.main(HelloStorm.java:36) ~[classes/:?]</p>
  </blockquote>