Apache Storm:InvalidTopologyException(msg:Component:[x]从不存在的组件[y]

时间:2016-04-13 10:27:31

标签: java apache-storm

我使用了this blog中的代码(效果很好):

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());

但是当我调整它有两个读取线的喷口时,将线发送到两个word-spitter螺栓,最后将结果发送到单个word-counter螺栓,抛出无效拓扑的例外。

我的调整代码

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());

拓扑有什么问题?我没有看到任何不正确的流程。 word-spitter2在实际创建时如何不存在?

  

6661 [main] INFO b.s.d.nimbus - [req 1]访问:校长:   op:submitTopology 6718 [main] WARN b.s.d.nimbus - 拓扑提交   例外。 (topology name ='HelloStorm')#InvalidTopologyException   InvalidTopologyException(msg:Component:[word-counter]订阅   不存在的组件[word-splitter2])6721 [main] ERROR   o.a.s.s.o.a.z.s.NIOServerCnxnFactory - Thread Thread [main,5,main]去世   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(原生方法)   〜[?: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]在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(未知来源)   〜[storm-core-0.10.0.jar:0.10.0] at   com.spnotes.storm.HelloStorm.main(HelloStorm.java:36)〜[classes /:?]

1 个答案:

答案 0 :(得分:2)

你得到错字 - sp l itter2。

builder.setBolt(&#34; word-spitter2 &#34;,新的WordSpitterBolt())。shuffleGrouping(&#34; line-reader-spout2&#34;); builder.setBolt(&#34; word-counter&#34;,new WordCounterBolt(),2).shuffleGrouping(&#34; word-spitter&#34;)。shuffleGrouping(&#34; word-splitter2 < /强>&#34);