You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@kafka.apache.org by Sravanthi Gottam <Sr...@CENTENE.COM> on 2018/09/20 15:31:09 UTC

Issue in Creating the Kafka Consumer

Hi Team,

I am facing the issue in creating the Kafka consumer. I am giving the jaas config file in the build path


10:14:00,765 WARN  [org.springframework.web.context.support.AnnotationConfigWebApplicationContext] (ServerService Thread Pool -- 84) Exception encountered during context initialization - cancelling refresh attempt: org.springframework.context.ApplicationContextException: Failed to start bean 'org.springframework.kafka.config.internalKafkaListenerEndpointRegistry'; nested exception is org.apache.kafka.common.KafkaException: Failed to construct kafka consumer
10:14:00,789 ERROR [org.springframework.web.servlet.DispatcherServlet] (ServerService Thread Pool -- 84) Context initialization failed: org.springframework.context.ApplicationContextException: Failed to start bean 'org.springframework.kafka.config.internalKafkaListenerEndpointRegistry'; nested exception is org.apache.kafka.common.KafkaException: Failed to construct kafka consumer
       at org.springframework.context.support.DefaultLifecycleProcessor.doStart(DefaultLifecycleProcessor.java:176) [spring-context-4.3.3.RELEASE.jar:4.3.3.RELEASE]
       at org.springframework.context.support.DefaultLifecycleProcessor.access$200(DefaultLifecycleProcessor.java:51) [spring-context-4.3.3.RELEASE.jar:4.3.3.RELEASE]
       at org.springframework.context.support.DefaultLifecycleProcessor$LifecycleGroup.start(DefaultLifecycleProcessor.java:346) [spring-context-4.3.3.RELEASE.jar:4.3.3.RELEASE]
       at org.springframework.context.support.DefaultLifecycleProcessor.startBeans(DefaultLifecycleProcessor.java:149) [spring-context-4.3.3.RELEASE.jar:4.3.3.RELEASE]

... 24 more
Caused by: org.apache.kafka.common.KafkaException: java.lang.IllegalArgumentException: No serviceName defined in either JAAS or Kafka config
       at org.apache.kafka.common.network.SaslChannelBuilder.configure(SaslChannelBuilder.java:98) [kafka-clients-0.11.0.0.jar:]
       at org.apache.kafka.common.network.ChannelBuilders.create(ChannelBuilders.java:112) [kafka-clients-0.11.0.0.jar:]
       at org.apache.kafka.common.network.ChannelBuilders.clientChannelBuilder(ChannelBuilders.java:58) [kafka-clients-0.11.0.0.jar:]
       at org.apache.kafka.clients.ClientUtils.createChannelBuilder(ClientUtils.java:88) [kafka-clients-0.11.0.0.jar:]
       at org.apache.kafka.clients.consumer.KafkaConsumer.<init>(KafkaConsumer.java:695) [kafka-clients-0.11.0.0.jar:]
       ... 36 more
Caused by: java.lang.IllegalArgumentException: No serviceName defined in either JAAS or Kafka config
       at org.apache.kafka.common.security.kerberos.KerberosLogin.getServiceName(KerberosLogin.java:298) [kafka-clients-0.11.0.0.jar:]
       at org.apache.kafka.common.security.kerberos.KerberosLogin.configure(KerberosLogin.java:87) [kafka-clients-0.11.0.0.jar:]
       at org.apache.kafka.common.security.authenticator.LoginManager.<init>(LoginManager.java:49) [kafka-clients-0.11.0.0.jar:]
       at org.apache.kafka.common.security.authenticator.LoginManager.acquireLoginManager(LoginManager.java:73) [kafka-clients-0.11.0.0.jar:]
       at org.apache.kafka.common.network.SaslChannelBuilder.configure(SaslChannelBuilder.java:90) [kafka-clients-0.11.0.0.jar:]
       ... 40 more


Thanks,
Sravanthi Gottam
Medical Management Systems

[Centene logo]
7930 Clayton Rd | St Louis, MO 63117
Ext: 8099453
Sravanthi.gottam@centene.com<ma...@centene.com>

CONFIDENTIALITY NOTICE: This communication contains information intended for the use of the individuals to whom it is addressed and may contain information that is privileged, confidential or exempt from other disclosure under applicable law. If you are not the intended recipient, you are notified that any disclosure, printing, copying, distribution or use of the contents is prohibited. If you have received this in error, please notify the sender immediately by telephone or by returning it by return mail and then permanently delete the communication from your system. Thank you.

Re: Issue in Creating the Kafka Consumer

Posted by Attila Sasvári <as...@apache.org>.
Hi Sravanthi,

Do I understand correctly that you pass the path to your JAAS configuration
file to the JVM via a system property  (e.g
-Djava.security.auth.login.config=/path_to_your_directory/jaas.conf )?

From the error message:
> Caused by: _java.lang.IllegalArgumentException_: No serviceName
> defined in either JAAS or Kafka config
>        at org.apache.kafka.common.security.kerberos.KerberosLogin ...
it looks like sasl.kerberos.service.name is not set.

Make sure you define all required config properties (such as
sasl.kerberos.service.name and security.protocol) via consumer properties.
For example, if service name is kafka, then set
sasl.kerberos.service.name=kafka
in your client config. If you use spring-kafka, you can pass a path to the
config properties file or consumer properties programatically.

To read more about the configuration of clients using SASL/Kerberos:
http://kafka.apache.org/documentation.html#security_sasl_kerberos_clientconfig

Hope this helps,
- Attila


On Thu, Sep 20, 2018 at 6:51 PM Harsha <ka...@harsha.io> wrote:

>
> It looks like you are trying to connect to SASL Kafka broker? If that's
> the case make sure you follow the dochttp://
> kafka.apache.org/documentation.html#security_jaas_client
> to pass in JAAS config with the KafkaClient section to your
> consumer. -Harsha
> On Thu, Sep 20, 2018, at 8:31 AM, Sravanthi Gottam wrote:
> > Hi Team,
>
>
> >
>
>
> > I am facing the issue in creating the Kafka consumer. I am giving the
> > jaas config file in the build path>
>
>
> >
>
>
> > 10:14:00,765 WARN  [org.springframework.web.context.support.Annotatio-
> > nConfigWebApplicationContext] (ServerService Thread Pool -- 84)
> > Exception encountered during context initialization - cancelling
> > refresh attempt:
> > _org.springframework.context.ApplicationContextException_: Failed to
> > start bean 'org.springframework.kafka.config.internalKafkaListenerEnd-
> > pointRegistry'; nested exception is
> > _org.apache.kafka.common.KafkaException_: Failed to construct kafka
> > consumer> 10:14:00,789 ERROR
> [org.springframework.web.servlet.DispatcherServlet]
> > (ServerService Thread Pool -- 84) Context initialization failed:
> > _org.springframework.context.ApplicationContextException_: Failed to
> > start bean 'org.springframework.kafka.config.internalKafkaListenerEnd-
> > pointRegistry'; nested exception is
> > _org.apache.kafka.common.KafkaException_: Failed to construct kafka
> > consumer>        at
> org.springframework.context.support.DefaultLifecycleProcess-
> >        or.doStart(_DefaultLifecycleProcessor.java:176_) [spring-context-
> >        4.3.3.RELEASE.jar:4.3.3.RELEASE]>        at
> org.springframework.context.support.DefaultLifecycleProcess-
> >        or.access$200(_DefaultLifecycleProcessor.java:51_)
> [spring-context-
> >        4.3.3.RELEASE.jar:4.3.3.RELEASE]>        at
> org.springframework.context.support.DefaultLifecycleProcess-
> >        or$LifecycleGroup.start(_DefaultLifecycleProcessor.java:346_)
> >        [spring-context-4.3.3.RELEASE.jar:4.3.3.RELEASE]>        at
> org.springframework.context.support.DefaultLifecycleProcess-
> >        or.startBeans(_DefaultLifecycleProcessor.java:149_)
> [spring-context-
> >        4.3.3.RELEASE.jar:4.3.3.RELEASE]>
>
>
> > ... 24 more
>
>
> > Caused by: _org.apache.kafka.common.KafkaException_:
> > _java.lang.IllegalArgumentException_: No serviceName defined in either
> > JAAS or Kafka config>        at
> org.apache.kafka.common.network.SaslChannelBuilder.configur-
> >        e(_SaslChannelBuilder.java:98_) [kafka-clients-0.11.0.0.jar:]>
>     at org.apache.kafka.common.network.ChannelBuilders.create(_Cha-
> >        nnelBuilders.java:112_) [kafka-clients-0.11.0.0.jar:]>        at
> org.apache.kafka.common.network.ChannelBuilders.clientChann-
> >        elBuilder(_ChannelBuilders.java:58_) [kafka-clients-
> >        0.11.0.0.jar:]>        at
> org.apache.kafka.clients.ClientUtils.createChannelBuilder(_-
> >        ClientUtils.java:88_) [kafka-clients-0.11.0.0.jar:]>        at
> org.apache.kafka.clients.consumer.KafkaConsumer.<init>(_Kaf-
> >        kaConsumer.java:695_) [kafka-clients-0.11.0.0.jar:]>        ...
> 36 more
>
>
> > Caused by: _java.lang.IllegalArgumentException_: No serviceName
> > defined in either JAAS or Kafka config>        at
> org.apache.kafka.common.security.kerberos.KerberosLogin.get-
> >        ServiceName(_KerberosLogin.java:298_) [kafka-clients-
> >        0.11.0.0.jar:]>        at
> org.apache.kafka.common.security.kerberos.KerberosLogin.con-
> >        figure(_KerberosLogin.java:87_) [kafka-clients-0.11.0.0.jar:]>
>     at org.apache.kafka.common.security.authenticator.LoginManager-
> >        .<init>(_LoginManager.java:49_) [kafka-clients-0.11.0.0.jar:]>
>     at org.apache.kafka.common.security.authenticator.LoginManager-
> >        .acquireLoginManager(_LoginManager.java:73_) [kafka-clients-
> >        0.11.0.0.jar:]>        at
> org.apache.kafka.common.network.SaslChannelBuilder.configur-
> >        e(_SaslChannelBuilder.java:90_) [kafka-clients-0.11.0.0.jar:]>
>     ... 40 more
>
>
> >
>
>
> >
>
>
> > Thanks,
>
>
> > *Sravanthi Gottam*
>
>
> > Medical Management Systems
>
>
> >
>
>
> > Centene logo
>
>
> > 7930 Clayton Rd | St Louis, MO 63117
>
>
> > Ext: 8099453
>
>
> > _Sravanthi.gottam@centene.com_
>
>
> >
>
>
> > CONFIDENTIALITY NOTICE: This communication contains information
> > intended for the use of the individuals to whom it is addressed and
> > may contain information that is privileged, confidential or exempt
> > from other disclosure under applicable law. If you are not the
> > intended recipient, you are notified that any disclosure, printing,
> > copying, distribution or use of the contents is prohibited. If you
> > have received this in error, please notify the sender immediately by
> > telephone or by returning it by return mail and then permanently
> > delete the communication from your system. Thank you.
>

Re: Issue in Creating the Kafka Consumer

Posted by Harsha <ka...@harsha.io>.
It looks like you are trying to connect to SASL Kafka broker? If that's
the case make sure you follow the dochttp://kafka.apache.org/documentation.html#security_jaas_client
to pass in JAAS config with the KafkaClient section to your
consumer. -Harsha
On Thu, Sep 20, 2018, at 8:31 AM, Sravanthi Gottam wrote:
> Hi Team,


>  


> I am facing the issue in creating the Kafka consumer. I am giving the
> jaas config file in the build path>  


>  


> 10:14:00,765 WARN  [org.springframework.web.context.support.Annotatio-
> nConfigWebApplicationContext] (ServerService Thread Pool -- 84)
> Exception encountered during context initialization - cancelling
> refresh attempt:
> _org.springframework.context.ApplicationContextException_: Failed to
> start bean 'org.springframework.kafka.config.internalKafkaListenerEnd-
> pointRegistry'; nested exception is
> _org.apache.kafka.common.KafkaException_: Failed to construct kafka
> consumer> 10:14:00,789 ERROR [org.springframework.web.servlet.DispatcherServlet]
> (ServerService Thread Pool -- 84) Context initialization failed:
> _org.springframework.context.ApplicationContextException_: Failed to
> start bean 'org.springframework.kafka.config.internalKafkaListenerEnd-
> pointRegistry'; nested exception is
> _org.apache.kafka.common.KafkaException_: Failed to construct kafka
> consumer>        at org.springframework.context.support.DefaultLifecycleProcess-
>        or.doStart(_DefaultLifecycleProcessor.java:176_) [spring-context-
>        4.3.3.RELEASE.jar:4.3.3.RELEASE]>        at org.springframework.context.support.DefaultLifecycleProcess-
>        or.access$200(_DefaultLifecycleProcessor.java:51_) [spring-context-
>        4.3.3.RELEASE.jar:4.3.3.RELEASE]>        at org.springframework.context.support.DefaultLifecycleProcess-
>        or$LifecycleGroup.start(_DefaultLifecycleProcessor.java:346_)
>        [spring-context-4.3.3.RELEASE.jar:4.3.3.RELEASE]>        at org.springframework.context.support.DefaultLifecycleProcess-
>        or.startBeans(_DefaultLifecycleProcessor.java:149_) [spring-context-
>        4.3.3.RELEASE.jar:4.3.3.RELEASE]>  


> ... 24 more


> Caused by: _org.apache.kafka.common.KafkaException_:
> _java.lang.IllegalArgumentException_: No serviceName defined in either
> JAAS or Kafka config>        at org.apache.kafka.common.network.SaslChannelBuilder.configur-
>        e(_SaslChannelBuilder.java:98_) [kafka-clients-0.11.0.0.jar:]>        at org.apache.kafka.common.network.ChannelBuilders.create(_Cha-
>        nnelBuilders.java:112_) [kafka-clients-0.11.0.0.jar:]>        at org.apache.kafka.common.network.ChannelBuilders.clientChann-
>        elBuilder(_ChannelBuilders.java:58_) [kafka-clients-
>        0.11.0.0.jar:]>        at org.apache.kafka.clients.ClientUtils.createChannelBuilder(_-
>        ClientUtils.java:88_) [kafka-clients-0.11.0.0.jar:]>        at org.apache.kafka.clients.consumer.KafkaConsumer.<init>(_Kaf-
>        kaConsumer.java:695_) [kafka-clients-0.11.0.0.jar:]>        ... 36 more


> Caused by: _java.lang.IllegalArgumentException_: No serviceName
> defined in either JAAS or Kafka config>        at org.apache.kafka.common.security.kerberos.KerberosLogin.get-
>        ServiceName(_KerberosLogin.java:298_) [kafka-clients-
>        0.11.0.0.jar:]>        at org.apache.kafka.common.security.kerberos.KerberosLogin.con-
>        figure(_KerberosLogin.java:87_) [kafka-clients-0.11.0.0.jar:]>        at org.apache.kafka.common.security.authenticator.LoginManager-
>        .<init>(_LoginManager.java:49_) [kafka-clients-0.11.0.0.jar:]>        at org.apache.kafka.common.security.authenticator.LoginManager-
>        .acquireLoginManager(_LoginManager.java:73_) [kafka-clients-
>        0.11.0.0.jar:]>        at org.apache.kafka.common.network.SaslChannelBuilder.configur-
>        e(_SaslChannelBuilder.java:90_) [kafka-clients-0.11.0.0.jar:]>        ... 40 more


>  


>  


> Thanks,


> *Sravanthi Gottam*


> Medical Management Systems


>  


> Centene logo


> 7930 Clayton Rd | St Louis, MO 63117


> Ext: 8099453


> _Sravanthi.gottam@centene.com_


>  


> CONFIDENTIALITY NOTICE: This communication contains information
> intended for the use of the individuals to whom it is addressed and
> may contain information that is privileged, confidential or exempt
> from other disclosure under applicable law. If you are not the
> intended recipient, you are notified that any disclosure, printing,
> copying, distribution or use of the contents is prohibited. If you
> have received this in error, please notify the sender immediately by
> telephone or by returning it by return mail and then permanently
> delete the communication from your system. Thank you.