首页  |  知识库  |  资源下载  |  在线工具  |  A-Z  •  JAR  •  名词查         

解决运行kafka客户端报"java.lang.NoClassDefFoundError: org/apache/log4j/Level"异常日志

标签:NoClassDefFoundError,ClassNotFoundException,kafka缺log4j依赖包     发布时间:2019-03-25   

一、异常解决说明

关于kafka客户端消息订阅和产生的项目demo,缺少log4j-1.2.14.jar依赖包,报"Failed to instantiate SLF4J LoggerFactory..Reported exception:..

java.lang.NoClassDefFoundError: org/apache/log4j/Level",详细日志如下

Failed to instantiate SLF4J LoggerFactory@b@Reported exception:@b@java.lang.NoClassDefFoundError: org/apache/log4j/Level@b@	at org.slf4j.LoggerFactory.bind(LoggerFactory.java:128)@b@	at org.slf4j.LoggerFactory.performInitialization(LoggerFactory.java:107)@b@	at org.slf4j.LoggerFactory.getILoggerFactory(LoggerFactory.java:295)@b@	at org.slf4j.LoggerFactory.getLogger(LoggerFactory.java:269)@b@	at org.slf4j.LoggerFactory.getLogger(LoggerFactory.java:281)@b@	at org.apache.kafka.clients.producer.KafkaProducer.<clinit>(KafkaProducer.java:125)@b@	at com.xwood.test.kafka.KafkaProducerTest.main(KafkaProducerTest.java:25)@b@Caused by: java.lang.ClassNotFoundException: org.apache.log4j.Level@b@	at java.net.URLClassLoader$1.run(URLClassLoader.java:372)@b@	at java.net.URLClassLoader$1.run(URLClassLoader.java:361)@b@	at java.security.AccessController.doPrivileged(Native Method)@b@	at java.net.URLClassLoader.findClass(URLClassLoader.java:360)@b@	at java.lang.ClassLoader.loadClass(ClassLoader.java:424)@b@	at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:308)@b@	at java.lang.ClassLoader.loadClass(ClassLoader.java:357)@b@	... 7 more