< invalidtopologyexception invalidtopologyexception无效拓扑异常(msg:field storm.zookeeper.servers 必须是java.lang.string的iterable)>

ki0zmccv  于 2021-06-21  发布在  Storm
关注(0)|答案(2)|浏览(493)

我获取了示例字数代码,并尝试提交到远程nimbus服务器而不提交到localcluster。
当我在客户端使用下面的代码提交时,当我运行./storm jar file/path/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

icnyk63a

icnyk63a1#

正是异常所说的:config.storm\u zookeeper\u servers应该是字符串的iterable,而不是字符串。所以试着替换

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

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

wlp8pajw2#

问题可能是由于storm.yaml文件中的错误造成的,请确保对应于storm.zookeeper.server的条目的格式如下所示:storm.zookeeper.server:(space)-(space)“ip address”。也就是说,连字符和ip地址之间以及从新行开始处应该有一个空格。

相关问题