连接kafka报错Failed to construct kafka consumer----EncryptionKey: Key bytes cannot be null!

部门kafka升级由之前的0.8版本升级到1.0以上,调试的时候报下面的错误,网上也没搜到相关内容,最后发现是因为java进程启动参数之一直指定了依赖文件路径: -Djava.ext.dirs=$BASEDIR,而这种写法会覆盖默认的ext值:jre/lib/ext,新版kafka认证对其下的包有依赖

改正: -Djava.ext.dirs=$JAVA_HOME/jre/lib/ext:$BASEDIR

报错内容如下

org.apache.kafka.common.KafkaException: Failed to construct kafka consumer

.........................其它报错省略..............................

Caused by: javax.security.auth.login.LoginException: java.lang.IllegalArgumentException: EncryptionKey: Key bytes cannot be null!
    at sun.security.krb5.EncryptionKey.(EncryptionKey.java:241)
    at sun.security.krb5.EncryptionKey.acquireSecretKey(EncryptionKey.java:189)
    at sun.security.krb5.EncryptionKey.acquireSecretKey(EncryptionKey.java:174)
    at sun.security.krb5.KrbAsRep.decryptUsingPassword(KrbAsRep.java:134)
    at sun.security.krb5.KrbAsReqBuilder.resolve(KrbAsReqBuilder.java:290)
    at sun.security.krb5.KrbAsReqBuilder.action(KrbAsReqBuilder.java:364)
    at com.sun.security.auth.module.Krb5LoginModule.attemptAuthentication(Krb5LoginModule.java:725)
    at com.sun.security.auth.module.Krb5LoginModule.login(Krb5LoginModule.java:584)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:606)
    at javax.security.auth.login.LoginContext.invoke(LoginContext.java:762)
    at javax.security.auth.login.LoginContext.access$000(LoginContext.java:203)
    at javax.security.auth.login.LoginContext$4.run(LoginContext.java:690)
    at javax.security.auth.login.LoginContext$4.run(LoginContext.java:688)
    at java.security.AccessController.doPrivileged(Native Method)
    at javax.security.auth.login.LoginContext.invokePriv(LoginContext.java:687)
    at javax.security.auth.login.LoginContext.login(LoginContext.java:595)
    at org.apache.kafka.common.security.authenticator.AbstractLogin.loginByJdqSdk(AbstractLogin.java:121)
    at org.apache.kafka.common.security.authenticator.AbstractLogin.login(AbstractLogin.java:69)
    at org.apache.kafka.common.security.kerberos.KerberosLogin.login(KerberosLogin.java:120)
    at org.apache.kafka.common.security.authenticator.LoginManager.(LoginManager.java:46)
    at org.apache.kafka.common.security.authenticator.LoginManager.acquireLoginManager(LoginManager.java:68)
    at org.apache.kafka.common.network.SaslChannelBuilder.configure(SaslChannelBuilder.java:81)
    at org.apache.kafka.common.network.ChannelBuilders.create(ChannelBuilders.java:70)
    at org.apache.kafka.clients.ClientUtils.createChannelBuilder(ClientUtils.java:85)
    at org.apache.kafka.clients.consumer.KafkaConsumer.(KafkaConsumer.java:646)
    at org.apache.kafka.clients.consumer.KafkaConsumer.(KafkaConsumer.java:585)
    at org.apache.kafka.clients.consumer.KafkaConsumer.(KafkaConsumer.java:567)
    at mc.cal.ClickConsume.ClickConsume.Consume(ClickConsume.java:65)
    at mc.cal.ClickConsume.ClickConsume.run(ClickConsume.java:46)

    at javax.security.auth.login.LoginContext.invoke(LoginContext.java:864)
    at javax.security.auth.login.LoginContext.access$000(LoginContext.java:203)
    at javax.security.auth.login.LoginContext$4.run(LoginContext.java:690)
    at javax.security.auth.login.LoginContext$4.run(LoginContext.java:688)
    at java.security.AccessController.doPrivileged(Native Method)
    at javax.security.auth.login.LoginContext.invokePriv(LoginContext.java:687)
    at javax.security.auth.login.LoginContext.login(LoginContext.java:595)
    at org.apache.kafka.common.security.authenticator.AbstractLogin.loginByJdqSdk(AbstractLogin.java:121)
    at org.apache.kafka.common.security.authenticator.AbstractLogin.login(AbstractLogin.java:69)
    at org.apache.kafka.common.security.kerberos.KerberosLogin.login(KerberosLogin.java:120)
    at org.apache.kafka.common.security.authenticator.LoginManager.(LoginManager.java:46)
    at org.apache.kafka.common.security.authenticator.LoginManager.acquireLoginManager(LoginManager.java:68)
    at org.apache.kafka.common.network.SaslChannelBuilder.configure(SaslChannelBuilder.java:81)
    ... 7 more

你可能感兴趣的:(消息中间件)