2015-05-25 94 views
2

我試圖用卡夫卡作爲輸入正在部署在風暴clustre.I一個簡單的字數拓撲結構(卡夫卡噴口)。這是我收到錯誤而風暴羣集上部署拓撲

java.lang.NoClassDefFoundError: Could not initialize class org.apache.log4j.Log4jLoggerFactory at org.apache.log4j.Logger.getLogger(Logger.java:39) at kafka.utils.Logging$class.logger(Logging.scala:24) at kafka.consumer.SimpleConsumer.logger$lzycompute(SimpleConsumer.scala:30) at kafka.consumer.SimpleConsumer.logger(SimpleConsumer.scala:30) at kafka.utils.Logging$class.info(Logging.scala:67) at kafka.consumer.SimpleConsumer.info(SimpleConsumer.scala:30) at kafka.consumer.SimpleConsumer.liftedTree1$1(SimpleConsumer.scala:74) at kafka.consumer.SimpleConsumer.kafka$consumer$SimpleConsumer$$sendRequest(SimpleConsumer.scala:68) at kafka.consumer.SimpleConsumer.getOffsetsBefore(SimpleConsumer.scala:127) at kafka.javaapi.consumer.SimpleConsumer.getOffsetsBefore(SimpleConsumer.scala:79) at storm.kafka.KafkaUtils.getOffset(KafkaUtils.java:77) at storm.kafka.KafkaUtils.getOffset(KafkaUtils.java:67) at storm.kafka.PartitionManager.(PartitionManager.java:83) at storm.kafka.ZkCoordinator.refresh(ZkCoordinator.java:98) at storm.kafka.ZkCoordinator.getMyManagedPartitions(ZkCoordinator.java:69) at storm.kafka.KafkaSpout.nextTuple(KafkaSpout.java:135) at backtype.storm.daemon.executor$fn__4654$fn__4669$fn__4698.invoke(executor.clj:565) at backtype.storm.util$async_loop$fn__458.invoke(util.clj:463) at clojure.lang.AFn.run(AFn.java:24) at java.lang.Thread.run(Thread.java:745)

回答

2

錯誤通過在我的風暴庫中添加log4j-over-slf4j-1.6.6.jar解決了這個問題。

+0

你知道爲什麼這個修補程序有效嗎? – mbfisher

1

我使用

  • 風暴0.9.6
  • 卡夫卡0.9.0

風暴0.9.6,它使用SLF4J。所以你需要從你的kafka引用中排除這個,幷包含log4j。以下是我的pom.xml

<dependency> 
    <groupId>org.apache.kafka</groupId> 
    <artifactId>kafka_2.10</artifactId> 
    <version>0.9.0.0</version> 
    <exclusions> 
     <exclusion> 
      <groupId>org.apache.zookeeper</groupId> 
      <artifactId>zookeeper</artifactId> 
     </exclusion> 
     <exclusion> 
      <groupId>org.slf4j</groupId> 
      <artifactId>slf4j-log4j12</artifactId> 
     </exclusion> 
     <!--<exclusion>--> 
      <!--<groupId>log4j</groupId>--> 
      <!--<artifactId>log4j</artifactId>--> 
     <!--</exclusion>--> 
    </exclusions> 
</dependency>