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

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


+
sphinx jiang 2013-08-06, 12:34
+
Jun Rao 2013-08-06, 16:23
Copy link to this message
-
Re: problem with adapter
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 <[EMAIL PROTECTED]>

> 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)

 
+
Jun Rao 2013-08-07, 14:45