Uploaded image for project: 'Kafka'
  1. Kafka
  2. KAFKA-6313

Kafka Core should have explicit SLF4J API dependency

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Resolved
    • Major
    • Resolution: Fixed
    • 1.1.0
    • 1.1.0
    • core
    • None

    Description

      In an application that depends on the Kafka server artifacts with:

      	<dependency>
      		<groupId>org.apache.kafka</groupId>
      		<artifactId>kafka_2.11</artifactId>
      		<version>1.1.0-SNAPSHOT</version>
      	</dependency>
      

      and then running the server programmatically, the following error occurs:

      [2017-11-23 01:01:45,029] INFO Shutting down producer (kafka.producer.Producer:63)
      [2017-11-23 01:01:45,051] INFO Closing all sync producers (kafka.producer.ProducerPool:63)
      [2017-11-23 01:01:45,052] INFO Producer shutdown completed in 23 ms (kafka.producer.Producer:63)
      [2017-11-23 01:01:45,052] INFO [KafkaServer id=1] shutting down (kafka.server.KafkaServer:63)
      [2017-11-23 01:01:45,057] ERROR [KafkaServer id=1] Fatal error during KafkaServer shutdown. (kafka.server.KafkaServer:161)
      java.lang.NoClassDefFoundError: org/slf4j/event/Level
      	at kafka.utils.CoreUtils$.swallow$default$3(CoreUtils.scala:83)
      	at kafka.server.KafkaServer.shutdown(KafkaServer.scala:520)
             ...
      Caused by: java.lang.ClassNotFoundException: org.slf4j.event.Level
      	at java.net.URLClassLoader$1.run(URLClassLoader.java:359)
      	at java.net.URLClassLoader$1.run(URLClassLoader.java:348)
      	at java.security.AccessController.doPrivileged(Native Method)
      	at java.net.URLClassLoader.findClass(URLClassLoader.java:347)
      	at java.lang.ClassLoader.loadClass(ClassLoader.java:425)
      	at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:312)
      	at java.lang.ClassLoader.loadClass(ClassLoader.java:358)
      	... 25 more
      

      It appears that KAFKA-1044 and this PR removed the use of Log4J from Core but added use of the org.slf4j.event.Level in CoreUtils.scala. The org.slf4j.event.Level class is in the org.slf4j:slf4j-api artifact, which is currently not included in the dependencies of org.apache.kafka:kafka_2.11:1.1.0-SNAPSHOT. Because this is needed by the server, the SLF4J API library probably needs to be added to the dependencies.

      viktorsomogyi and ijuma, was this intentional, or is it intended that the SLF4J API be marked as provided? BTW, I marked this as CRITICAL just because this probably needs to be sorted out before the release.

      Update: As the comments below explain, the actual problem is a bit different to what is in the JIRA description.

      Attachments

        Issue Links

          Activity

            People

              rhauch Randall Hauch
              rhauch Randall Hauch
              Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: