Lahiru
Lahiru

Reputation: 709

<InvalidTopologyException InvalidTopologyException(msg:Field storm.zookeeper.servers must be an Iterable of java.lang.String)>

I took the sample word-count code and tried to submit to a remote nimbus server without submitting to LocalCluster.I used the following code in client side and the following yaml configuration the server and ZK is started separately.

When I submit using the below code in the client side I get the following error, when I ran the ./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)

Topology building code:

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 looks like this file.

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

Upvotes: 4

Views: 1578

Answers (2)

Manish
Manish

Reputation: 23

The problem can be due to the error in storm.yaml file, Make sure the entry corresponding to storm.zookeeper.server is in the format given below: storm.zookeeper.server: (space)-(space)"ip-address" .i.e there should be a space between hyphen and ip-address as well as from the start of new line.

Upvotes: 1

Ofri Raviv
Ofri Raviv

Reputation: 24823

Exactly what the exception says: Config.STORM_ZOOKEEPER_SERVERS should be an iterable of strings, and not a string. So try replacing

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

with

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

Upvotes: 1

Related Questions