2014-12-03 62 views
3

我拿了示例字數代碼並嘗試提交到遠程nimbus服務器而未提交到LocalCluster.I在客戶端使用以下代碼,以下yaml配置服務器和ZK分別啓動。<InvalidTopologyException InvalidTopologyException(msg:字段storm.zookeeper.servers必須是java.lang.String的Iterable)>

當我提交使用在客戶端我收到以下錯誤下面的代碼,當我跑了./storm jar文件/路徑/ JAR-file.jar

ut.pending":5000,"storm.zookeeper.servers":"149.160.221.43","topology.max.task.parallelism":3} 
308 [main] WARN backtype.storm.StormSubmitter - Topology submission exception: Field  storm.zookeeper.servers must be an Iterable of java.lang.String 
Exception in thread "main" InvalidTopologyException(msg:Field storm.zookeeper.servers must be an Iterable of java.lang.String) 
at backtype.storm.generated.Nimbus$submitTopology_result.read(Nimbus.java:2466) 
at org.apache.thrift7.TServiceClient.receiveBase(TServiceClient.java:78) 
at backtype.storm.generated.Nimbus$Client.recv_submitTopology(Nimbus.java:162) 
at backtype.storm.generated.Nimbus$Client.submitTopology(Nimbus.java:146) 
at backtype.storm.StormSubmitter.submitTopology(StormSubmitter.java:98) 
at backtype.storm.StormSubmitter.submitTopology(StormSubmitter.java:58) 
at storm.starter.WordCountTopology.main(WordCountTopology.java:110) 

拓撲結構建築規範:

System.setProperty("storm.jar","/Users/lginnali/work/airavata/storm/storm/examples/storm-starter/target/storm-starter-0.10.0-SNAPSHOT.jar"); 
TopologyBuilder builder = new TopologyBuilder(); 

builder.setSpout("spout", new RandomSentenceSpout(), 5); 

BoltDeclarer split = builder.setBolt("split", new SplitSentence(), 8); 
split.shuffleGrouping("spout"); 
builder.setBolt("count", new WordCount(), 12).fieldsGrouping("split", new Fields("word")); 

Config conf = new Config(); 
conf.put(Config.NIMBUS_HOST, "localhost"); 
conf.put(Config.NIMBUS_THRIFT_PORT,6627); 
conf.put(Config.STORM_ZOOKEEPER_PORT,2181); 
conf.put(Config.STORM_ZOOKEEPER_SERVERS,"localhost"); 
conf.setNumWorkers(20); 
conf.setMaxSpoutPending(5000); 


if (args != null && args.length > 0) { 
    conf.setNumWorkers(3); 

    StormSubmitter.submitTopologyWithProgressBar(args[0], conf, builder.createTopology()); 
} 

sample storm.yaml看起來像這個文件。

https://github.com/apache/storm/blob/master/conf/defaults.yaml

回答

1

正是異常說:Config.STORM_ZOOKEEPER_SERVERS應弦的迭代,而不是一個字符串。因此,嘗試用

conf.put(Config.STORM_ZOOKEEPER_SERVERS, Arrays.asList(new String[]{"localhost"})); 
+0

我使用Storm 1.0.0。我試過conf.put(Config.STORM_ZOOKEEPER_SERVERS,Arrays.asList(new String [] {「localhost」}));'但我得到了同樣的錯誤。其他解決方案? – Nav 2016-07-13 05:49:58

1

問題可以更換

conf.put(Config.STORM_ZOOKEEPER_SERVERS,"localhost"); 

由於storm.yaml文件中的錯誤,確保相應storm.zookeeper.server該條目格式如下: storm.zookeeper.server: (空格) - (空格)「ip-address」.ie應該在連字符和ip地址之間以及從新行開始處有一個空格。

相關問題