kafka-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From sphinx jiang <yishan...@gmail.com>
Subject Re: problem with adapter
Date Wed, 07 Aug 2013 09:13:36 GMT
Sorry, didn't find what should be set from the start page.

Here is the newest setting(with brokerlist):
log4j.appender.KAFKA=kafka.producer.KafkaLog4jAppender
log4j.appender.KAFKA.zkConnect=127.0.0.1:2180
log4j.appender.KAFKA.BrokerList=0:localhost:9092
log4j.appender.KAFKA.SerializerClass=kafka.serializer.StringEncoder
log4j.appender.KAFKA.Topic= 1650
log4j.logger.com.test.kafka.examples = INFO, KAFKA

and here is the outcoming:

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)
at
com.test.kafka.examples.SimpleConsumerDemo.main(SimpleConsumerDemo.java:57)
Caused by: java.lang.NullPointerException
at org.I0Itec.zkclient.ZkClient.close(ZkClient.java:915)
at org.I0Itec.zkclient.ZkClient.connect(ZkClient.java:888)
at org.I0Itec.zkclient.ZkClient.<init>(ZkClient.java:98)
at org.I0Itec.zkclient.ZkClient.<init>(ZkClient.java:84)
at
kafka.producer.ZKBrokerPartitionInfo.<init>(ZKBrokerPartitionInfo.scala:62)
at kafka.producer.Producer.<init>(Producer.scala:47)
at kafka.producer.Producer.<init>(Producer.scala:63)
at
kafka.producer.KafkaLog4jAppender.activateOptions(KafkaLog4jAppender.scala:70)
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)
at java.lang.J9VMInternals.initializeImpl(Native Method)
at java.lang.J9VMInternals.initialize(J9VMInternals.java:200)
... 11 more




2013/8/7 Jun Rao <junrao@gmail.com>

> Could you try just setting brokerlist?
>
> Thanks,
>
> Jun
>
>
> On Tue, Aug 6, 2013 at 5:34 AM, sphinx jiang <yishanj13@gmail.com> 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)
> >  at
> >
> com.test.kafka.examples.SimpleConsumerDemo.main(SimpleConsumerDemo.java:57)
> > Caused by: java.lang.NullPointerException
> > at org.I0Itec.zkclient.ZkClient.close(ZkClient.java:915)
> >  at org.I0Itec.zkclient.ZkClient.connect(ZkClient.java:888)
> > at org.I0Itec.zkclient.ZkClient.<init>(ZkClient.java:98)
> >  at org.I0Itec.zkclient.ZkClient.<init>(ZkClient.java:84)
> > at
> >
> kafka.producer.ZKBrokerPartitionInfo.<init>(ZKBrokerPartitionInfo.scala:62)
> >  at kafka.producer.Producer.<init>(Producer.scala:47)
> >
> > Without the logger appender, the code runs almost right.(Other problems
> > will be metioned in next mail.)
> >
>

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message