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

IBM JDK Class not found error when handling SASL authentication exception


    • Type: Bug
    • Status: Open
    • Priority: Major
    • Resolution: Unresolved
    • Affects Version/s: 2.1.0, 2.2.0, 2.1.1
    • Fix Version/s: None
    • Component/s: clients, core
    • Labels:
    • Environment:
      Any with IBM JDK 8 SR5 FP10


      When there is a problem with SASL authentication then enum KerberosError is being used to retrieve the error code. When IBM JDK is being used it tries to load a class com.ibm.security.krb5.internal.KrbException which is not present in all IBM JDK versions. This leads to NoClassDefFoundError which is not handled.

      I tested it on:
      java version "1.8.0_161"
      Java(TM) SE Runtime Environment (build - pxa6480sr5fp10-20180214_01(SR5 FP10))
      IBM J9 VM (build 2.9, JRE 1.8.0 Linux amd64-64 Compressed References 20180208_378436 (JIT enabled, AOT enabled)

      In this version of JDK class KrbException is in package com.ibm.security.krb5 (without internal). So the fully class name is: com.ibm.security.krb5.KrbException

      Full stack trace from the logs:

      [2019-03-27 06:50:00,113] ERROR Processor got uncaught exception. (kafka.network.Processor)
      java.lang.NoClassDefFoundError: org.apache.kafka.common.security.kerberos.KerberosError (initialization failure)
              at java.lang.J9VMInternals.initializationAlreadyFailed(J9VMInternals.java:96)
              at org.apache.kafka.common.security.authenticator.SaslServerAuthenticator.handleSaslToken(SaslServerAuthenticator.java:384)
              at org.apache.kafka.common.security.authenticator.SaslServerAuthenticator.authenticate(SaslServerAuthenticator.java:256)
              at org.apache.kafka.common.network.KafkaChannel.prepare(KafkaChannel.java:132)
              at org.apache.kafka.common.network.Selector.pollSelectionKeys(Selector.java:532)
              at org.apache.kafka.common.network.Selector.poll(Selector.java:467)
              at kafka.network.Processor.poll(SocketServer.scala:689)
              at kafka.network.Processor.run(SocketServer.scala:594)
              at java.lang.Thread.run(Thread.java:811)
      Caused by: org.apache.kafka.common.KafkaException: Kerberos exceptions could not be initialized
              at org.apache.kafka.common.security.kerberos.KerberosError.<clinit>(KerberosError.java:59)
              ... 8 more
      Caused by: java.lang.ClassNotFoundException: com.ibm.security.krb5.internal.KrbException
              at java.lang.Class.forNameImpl(Native Method)
              at java.lang.Class.forName(Class.java:297)
              at org.apache.kafka.common.security.kerberos.KerberosError.<clinit>(KerberosError.java:53)
              ... 8 more


          Issue Links



              • Assignee:
                ecomar Edoardo Comar
                afirus Arkadiusz Firus
              • Votes:
                0 Vote for this issue
                3 Start watching this issue


                • Created: