获取 backtype.storm.generated.InvalidTopologyException: null 。如果我评论对 setBolt 的调用,它就会运行
Getting backtype.storm.generated.InvalidTopologyException: null .If I comment call to setBolt it runs
如果评论 builder.setBolt 然后它运行 correctly.Please 告诉我错在哪里
TopologyBuilder builder = new TopologyBuilder();
builder.setSpout("words", new TestWordSpout(), 3);
//Calling setBolt
builder.setBolt("exc", new ExclaimBolt(),3)
.allGrouping("words");
Config conf = new Config();
conf.setDebug(false);
//conf.setNumWorkers(2);
LocalCluster cluster = new LocalCluster();
cluster.submitTopology("test", conf, builder.createTopology());
尚未在 Spout 中声明输出字段。
声明后它工作正常。
代码示例(in u bolt class):
@Override
public void declareOutputFields(OutputFieldsDeclarer declarer) {
declarer.declare(new Fields("msg"));//based on u project
}
如果评论 builder.setBolt 然后它运行 correctly.Please 告诉我错在哪里
TopologyBuilder builder = new TopologyBuilder();
builder.setSpout("words", new TestWordSpout(), 3);
//Calling setBolt
builder.setBolt("exc", new ExclaimBolt(),3)
.allGrouping("words");
Config conf = new Config();
conf.setDebug(false);
//conf.setNumWorkers(2);
LocalCluster cluster = new LocalCluster();
cluster.submitTopology("test", conf, builder.createTopology());
尚未在 Spout 中声明输出字段。 声明后它工作正常。
代码示例(in u bolt class):
@Override
public void declareOutputFields(OutputFieldsDeclarer declarer) {
declarer.declare(new Fields("msg"));//based on u project
}