I had similar problem with my setup. It may be different for you but in my case the producer could not resolve the broker host as registered in zookeeper. You make a request to the address specified in brokers list, which successfully returns the topic metadata but the broker might have registered itself with a different hostname .
You can check in zookeeper /brokers/ids directly to see under which name the broker is registered. It's probably not 192.168.1.200. I was running the broker on a VM so it was registered under the VM host name (ubuntu). I worked around it by adding my VM in the Windows hosts file. marc On Jun 20, 2013 3:09 AM, "Ran RanUser" <ranuse...@gmail.com> wrote: > I'm stumped: > > My sample Producer code does not work in Windows, but does work in Linux > (Ubunuty). > > My sample Consumer code is fine. > > - Kaka 0.8 (June 19), compiled using Scala 2.9.2 > - Java version is JDK 1.7x (Oracle version in Windows, OpenJDK on Ubuntu) > - 1 broker, 1 partition,1 replica, no compression, topic already created > called "test" > - Producer code throws exception when producer runs on Windows 7 regardless > if Kaka broker is running in Windows 7 or Ubuntu 12.04 > - Producer code works if run on Ubuntu 12.04 > - Consumer code works on Windows > > Producer code: > > val topic = "test" > val props = new Properties() > props.put("serializer.class", "kafka.serializer.StringEncoder"); > props.put("metadata.broker.list", "192.168.1.200:9092"); > val producer = new Producer[String, String](new ProducerConfig(props)) > val msg = new KeyedMessage(topic, "key1", "value1") > try { > producer.send(msg) > } > catch { > case e: Exception => > ... > } > > Stack trace: > > kafka.common.FailedToSendMessageException: Failed to send messages after 3 > tries. > at > > kafka.producer.async.DefaultEventHandler.handle(DefaultEventHandler.scala:90) > at kafka.producer.Producer.send(Producer.scala:74) > at kafka.javaapi.producer.Producer.send(Producer.scala:32) > at shops.runner.Runner$.main(Runner.scala:91) > > > Any ideas? > > > Thank you! >