Home | About | Sematext search-lucene.com search-hadoop.com
 Search Hadoop and all its subprojects:

Switch to Threaded View
Kafka >> mail # user >> problem with adapter


Copy link to this message
-
Re: problem with adapter
Could you try just setting brokerlist?

Thanks,

Jun
On Tue, Aug 6, 2013 at 5:34 AM, sphinx jiang <[EMAIL PROTECTED]> wrote:

> Hi, I am learning kafka 0.7 this days,  with a single node, :)
>
> When I run the example code, I defining the Kafka appender in my
> log4j.properties like the kafka apache quickstart page told.
>
> log4j.appender.KAFKA = kafka.producer.KafkaLog4jAppender
> log4j.appender.KAFKA.Host = localhost
> log4j.appender.KAFKA.SerializerClass = kafka.test.AppenderStringSerializer
> log4j.appender.KAFKA.Port = 9092
> log4j.appender.KAFKA.Topic = test
> log4j.logger.com.test.kafka.examples = INFO, KAFKA
>
> But then I met the following problems:
>
> log4j:WARN No such property [port] in kafka.producer.KafkaLog4jAppender.
> log4j:WARN No such property [host] in kafka.producer.KafkaLog4jAppender.
> Exception in thread "main" java.lang.ExceptionInInitializerError
>  at java.lang.J9VMInternals.initialize(J9VMInternals.java:222)
> at org.apache.log4j.Logger.getLogger(Logger.java:118)
>  at org.I0Itec.zkclient.ZkClient.<clinit>(ZkClient.java:57)
> at java.lang.J9VMInternals.initializeImpl(Native Method)
>  at java.lang.J9VMInternals.initialize(J9VMInternals.java:200)
> at
> kafka.producer.ZKBrokerPartitionInfo.<init>(ZKBrokerPartitionInfo.scala:62)
>  at kafka.producer.Producer.<init>(Producer.scala:47)
> at kafka.javaapi.producer.Producer.<init>(Producer.scala:33)
>  at kafka.javaapi.producer.Producer.<init>(Producer.scala:40)
> at com.test.kafka.examples.Producer.<init>(Producer.java:46)
>  at
>
> com.test.kafka.examples.SimpleConsumerDemo.generateData(SimpleConsumerDemo.java:40)
> at
> com.test.kafka.examples.SimpleConsumerDemo.main(SimpleConsumerDemo.java:57)
> Caused by: kafka.producer.async.MissingConfigException: One of these
> connection properties must be specified: zkConnect, brokerList.
> at
>
> kafka.producer.KafkaLog4jAppender.activateOptions(KafkaLog4jAppender.scala:59)
>  at
> org.apache.log4j.config.PropertySetter.activate(PropertySetter.java:257)
> at
>
> org.apache.log4j.config.PropertySetter.setProperties(PropertySetter.java:133)
>  at
>
> org.apache.log4j.config.PropertySetter.setProperties(PropertySetter.java:97)
> at
>
> org.apache.log4j.PropertyConfigurator.parseAppender(PropertyConfigurator.java:689)
>  at
>
> org.apache.log4j.PropertyConfigurator.parseCategory(PropertyConfigurator.java:647)
> at
>
> org.apache.log4j.PropertyConfigurator.parseCatsAndRenderers(PropertyConfigurator.java:568)
>  at
>
> org.apache.log4j.PropertyConfigurator.doConfigure(PropertyConfigurator.java:442)
> at
>
> org.apache.log4j.PropertyConfigurator.doConfigure(PropertyConfigurator.java:476)
>  at
>
> org.apache.log4j.helpers.OptionConverter.selectAndConfigure(OptionConverter.java:471)
> at org.apache.log4j.LogManager.<clinit>(LogManager.java:125)
>
> In the source code, there are port and host property, and I add the
> zkConnect, brokerList.
> log4j.appender.KAFKA.zkConnect =localhost:2181
> log4j.appender.KAFKA.brokerList = localhost:9092
>
> There are still problems here.
>
> log4j:WARN Using default encoder - kafka.serializer.StringEncoder
> log4j:WARN No appenders could be found for logger
> (org.I0Itec.zkclient.ZkEventThread).
> log4j:WARN Please initialize the log4j system properly.
> Exception in thread "main" java.lang.ExceptionInInitializerError
> at java.lang.J9VMInternals.initialize(J9VMInternals.java:222)
>  at org.apache.log4j.Logger.getLogger(Logger.java:118)
> at org.I0Itec.zkclient.ZkClient.<clinit>(ZkClient.java:57)
>  at java.lang.J9VMInternals.initializeImpl(Native Method)
> at java.lang.J9VMInternals.initialize(J9VMInternals.java:200)
>  at
> kafka.producer.ZKBrokerPartitionInfo.<init>(ZKBrokerPartitionInfo.scala:62)
> at kafka.producer.Producer.<init>(Producer.scala:47)
>  at kafka.javaapi.producer.Producer.<init>(Producer.scala:33)
> at kafka.javaapi.producer.Producer.<init>(Producer.scala:40)
>  at com.test.kafka.examples.Producer.<init>(Producer.java:46)
> at
>
> com.test.kafka.examples.SimpleConsumerDemo.generateData(SimpleConsumerDemo.java:40)