logging-log4j-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Bill Okara <billok...@gmail.com>
Subject Re: Log4j2 Kafka appender NullPointerException when put the related jars in tomcat lib
Date Thu, 18 Aug 2016 22:44:36 GMT
tried again, seemed like the .out extension got filtered out by mail server...

On Thu, Aug 18, 2016 at 4:41 PM, Bill Okara <billokara@gmail.com> wrote:
> attach the catalina.out again, didn't seem to go through last time...
>
>
> On Thu, Aug 18, 2016 at 4:33 PM, Bill Okara <billokara@gmail.com> wrote:
>> Hi,
>>
>> When trying out the log4j2 Kafka appender, it works ok if all the
>> log4j2/kafka-client related jars are packaged in the webapp's
>> WEB-INF/lib, like:
>>
>>>ls WEB-INF/lib/
>> jackson-core-2.8.1.jar
>> log4j-core-2.6.2.jar
>> lz4-1.3.0.jar
>> kafka-clients-0.10.0.1.jar
>> log4j-slf4j-impl-2.6.2.jar
>> slf4j-api-1.7.21.jar
>> log4j-api-2.6.2.jar
>> log4j-web-2.6.2.jar
>> snappy-java-1.1.2.6.jar
>>
>>
>> But if the jars are provided in tomcat/lib (for all webapps), and each
>> webapp will have its own log4j2.xml (as in attached war), then when
>> launching the webapp, will encounter:
>>
>> -----
>> Caused by: java.lang.NullPointerException
>>         at org.apache.kafka.clients.producer.KafkaProducer.close(KafkaProducer.java:658)
>>         at org.apache.kafka.clients.producer.KafkaProducer.<init>(KafkaProducer.java:333)
>>         at org.apache.kafka.clients.producer.KafkaProducer.<init>(KafkaProducer.java:188)
>>         at org.apache.logging.log4j.core.appender.mom.kafka.DefaultKafkaProducerFactory.newKafkaProducer(DefaultKafkaProducerFactory.java:29)
>>         at org.apache.logging.log4j.core.appender.mom.kafka.KafkaManager.startup(KafkaManager.java:86)
>>         at org.apache.logging.log4j.core.appender.mom.kafka.KafkaAppender.start(KafkaAppender.java:96)
>>         at org.apache.logging.log4j.core.config.AbstractConfiguration.start(AbstractConfiguration.java:247)
>>         at org.apache.logging.log4j.core.LoggerContext.setConfiguration(LoggerContext.java:496)
>>         at org.apache.logging.log4j.core.LoggerContext.reconfigure(LoggerContext.java:566)
>> ---------
>>
>> (full stack trace as in attached catalina.out)
>>
>>
>> To reproduce the error, simply:
>> 1) build the attached webapp, and deploy the output to tomcat/webapps
>> 2) move the WEB-INF/lib/*.jar to tomcat/lib (make sure WEB-INF/lib is
>> empty after move)
>> 3) start tomcat
>>
>> Tested with tomcat 7.0.70
>>
>> Anyone encounter similar problem? or is this a bug? (log4j2 or
>> kafka-client bug?)
>>
>>
>> Thanks,
>> Bill

Mime
View raw message