我尝试使用intellij运行风暴拓扑。直到今天,拓扑运行完全正常,但今天每次我尝试运行它时,我都会遇到以下错误:
Error:maven-resources-test:twitter_storm_new: java.lang.NegativeArraySizeException
有人能说出是否有办法解决它以及如何解决?
这是我的拓扑代码:
public class AuthorsAndFeaturesTopology {
public static final String PATH_TO_AUTHORS_AND_FEATURES_FILE="/home/christina/twitter_storm_new/CSV/features.csv";
public static final String PATH_TO_AUTHORS_AND_NEW_FEATURES_FILE="/home/christina/twitter_storm_new/CSV/featuresnew.csv";
public static final String keyword1="#blacklivesmatter";
public static final String keyword2="#germanwings";
public static final String keyword3="#bigdata";
public static void main(String[]args ) throws Exception {
TopologyBuilder topologyBuilder = new TopologyBuilder();
//topologyBuilder.setSpout("PROCESS_AUTHORS_AND_FEATURES_FILE", new ProcessAuthorsAndFeaturesFromCSVFileSpout(PATH_TO_AUTHORS_AND_FEATURES_FILE,keyword1,keyword2,keyword3),4);
Config config = new Config();
if (args != null && args.length > 0) {
config.setNumWorkers(10);
config.setMaxSpoutPending(100);
StormSubmitter.submitTopology(args[0], config, topologyBuilder.createTopology());
} else {
LocalCluster localCluster = new LocalCluster();
localCluster.submitTopology("Test", config, topologyBuilder.createTopology());
Utils.sleep(2*10000);
localCluster.killTopology("Test");
localCluster.shutdown();
}
}
}
答案 0 :(得分:5)
我刚刚与maven-resources-test:...:java.lang.NegativeArraySizeException
发生了类似的错误,但我在任何地方都找不到任何解决方案。
Maven 编译工作正常,只有来自IntelliJ的构建引发了这样的错误。
试图:
解决了我的问题的是构建 - >重建项目(可能与上面的一些一起)
答案 1 :(得分:1)
我也有这个问题。正如@Grx解释的那样,Build-> Rebuild Project解决了这个问题