ava.lang.NoClassDefFoundError:无法初始化类org.apache.log4j.Log4jLoggerFactory这个错误的原因是什么

时间:2017-02-02 06:06:41

标签: apache-storm

java.lang.NoClassDefFoundError:无法在kafka.utils.Logging $ class.logger(logging。)的org.apache.log4j.Logger.getLogger(Logger.java:39)中初始化类org.apache.log4j.Log4jLoggerFactory。 scala:24)at kafka.consumer.SimpleConsumer.logger $ lzycompute(SimpleConsumer.scala:35)at kafka.consumer.SimpleConsumer.logger(SimpleConsumer.scala:35)at kafka.utils.Logging $ class.info(Logging.scala :77)at kafka.consumer.SimpleConsumer.info(SimpleConsumer.scala:35)at kafka.consumer.SimpleConsumer.liftedTree1 $ 1(SimpleConsumer.scala:94)at kafka.consumer.SimpleConsumer.kafka $ consumer $ SimpleConsumer $$ sendRequest( SimpleConsumer.scala:83)at kafka.consumer.SimpleConsumer.getOffsetsBefore(SimpleConsumer.scala:149)at kafka.javaapi.consumer.SimpleConsumer.getOffsetsBefore(SimpleConsumer.scala:79)at org.apache.storm.kafka.KafkaUtils.getOffset (KafkaUtils.java:75)org.apache.storm.kafka.KafkaUtils.getOffset(KafkaUtils.java:65)at org.apache.storm.kafka.PartitionManager。(PartitionManager.java:103)at at org.apache.storm.kafka.ZkCoordinator.refresh(ZkCoordinator.java:98)org.apache.storm.kafka.ZkCoordinator.getMyManagedPartitions(ZkCoordinator.java:69)org.apache.storm.kafka.KafkaSpout.nextTuple( kafkaSpout.java:129)org.apache.storm.daemon.executor $ fn__7990 $ fn__8005 $ fn__8036.invoke(executor.clj:648)org.apache.storm.util $ async_loop $ fn__624.invoke(util.clj: 484)在java.lang.Thread.run(Thread.java:745)的clojure.lang.AFn.run(AFn.java:22)

1 个答案:

答案 0 :(得分:0)

尝试将依赖项添加到log4j,但是您需要将它们从storm中排除,以避免我在评论中添加的链接中出现的冲突:

        <dependency>
        <groupId>org.apache.logging.log4j</groupId>
        <artifactId>log4j-api</artifactId>
        <version>2.3</version>
    </dependency>
    <dependency>
        <groupId>org.apache.logging.log4j</groupId>
        <artifactId>log4j-core</artifactId>
        <version>2.3</version>
    </dependency>
    <dependency>
        <groupId>org.apache.logging.log4j</groupId>
        <artifactId>log4j-1.2-api</artifactId>
        <version>2.3</version>
    </dependency>
    <dependency>
        <groupId>org.apache.logging.log4j</groupId>
        <artifactId>log4j-jcl</artifactId>
        <version>2.3</version>
    </dependency>
    <dependency>
        <groupId>org.apache.logging.log4j</groupId>
        <artifactId>log4j-slf4j-impl</artifactId>
        <version>2.3</version>
    </dependency>