我正在运行风暴拓扑。这是基本的wordcount拓扑。我使用文本文件作为处理数据的源和风暴。虽然提交我正面临着这些问题。我对风暴很新。请指教我需要在以下代码中进行更改。谢谢你提前!!
我的拓扑
public class TopologyMain {
public static void main(String[] args) throws InterruptedException, AlreadyAliveException, InvalidTopologyException {
//Topology definition
TopologyBuilder builder = new TopologyBuilder();
builder.setSpout("word-reader",new WordReader());
builder.setBolt("word-normalizer", new WordNormalizer())
.shuffleGrouping("word-reader");
builder.setBolt("word-counter", new WordCounter(),1)
.fieldsGrouping("word-normalizer", new Fields("word"));
//Configuration
Config conf = new Config();
conf.put("wordsFile", args[0]);
conf.setDebug(false);
//Topology run
conf.put(Config.TOPOLOGY_MAX_SPOUT_PENDING, 1);
conf.put(Config.NIMBUS_HOST, "192.168.1.229");
//LocalCluster cluster = new LocalCluster();
//cluster.submitTopology("Getting-Started-Toplogie", conf, builder.createTopology());
//Thread.sleep(1000);
System.setProperty("storm.jar", "/home/raremile/st/examples-ch02-getting_started/target/Getting-Started-0.0.1-SNAPSHOT.jar");
StormSubmitter.submitTopology("Count-Word-Topology-With-Refresh-Cache", conf,
builder.createTopology());
//cluster.shutdown();
}
}
错误
线程“main”中的异常java.lang.NoSuchMethodError:backtype.storm.topology.TopologyBuilder.setBolt(Ljava / lang / String; Lbacktype / storm / topology / IBasicBolt; Ljava / lang / Integer;)Lbacktype / storm /拓扑/ BoltDeclarer; 在TopologyMain.main(TopologyMain.java:21)
我可以在本地模式下运行此代码而不会出现任何错误。
答案 0 :(得分:1)
将版本更改为0.9.0.1,我可以运行它
<dependency>
<groupId>storm</groupId>
<artifactId>storm</artifactId>
<version>0.9.0.1</version>
</dependency>