具有WindowedBolt的Storm拓扑中的异常

时间:2018-09-03 09:09:14

标签: apache-storm

我正在尝试运行具有窗口螺栓的拓扑,但是出现以下异常:

Exception in thread "main" java.lang.NullPointerException
    at org.apache.storm.topology.WindowedBoltExecutor.declareOutputFields(WindowedBoltExecutor.java:309)
    at org.apache.storm.topology.TopologyBuilder.getComponentCommon(TopologyBuilder.java:432)
    at org.apache.storm.topology.TopologyBuilder.createTopology(TopologyBuilder.java:120)
    at Main.main(Main.java:23)

我通过扩展BaseWindowedBolt创建了自定义窗口螺栓。

拓扑代码:

TopologyBuilder builder = new TopologyBuilder();
        builder.setSpout("integer", new RandomIntegerSpout(), 1);
        builder.setBolt("tumblingsum", new CustomTumblingSumWindow().withTumblingWindow(new Duration(10, TimeUnit.SECONDS)),1).shuffleGrouping("integer");
        builder.setBolt("final", new ResultBolt(),1).shuffleGrouping("tumblingsum");
        Config config = new Config();
        config.put(Config.TOPOLOGY_WORKERS, 1);
        StormSubmitter.submitTopology("Test-Windowing-Topology", config, builder.createTopology());

风暴版本为1.2.2

如果我在没有WindowedBolt的情况下在上述拓扑上运行,则它可以正常工作。

我想念什么吗?

谢谢

1 个答案:

答案 0 :(得分:0)

您要从中获得例外的行是https://github.com/apache/storm/blob/v1.2.2/storm-core/src/jvm/org/apache/storm/topology/WindowedBoltExecutor.java#L309

我的猜测是您的螺栓从SELECT 'c#' REGEXP '(^|[^\w])c#($|[^\w])' SELECT 'java' REGEXP '(^|[^\w])java($|[^\w])' 返回空值。这看起来像个错误,但是您可以通过从getComponentConfiguration返回一个空的映射来解决它。

提出https://issues.apache.org/jira/browse/STORM-3211进行修复。