Skip to content
This repository has been archived by the owner on Jul 27, 2023. It is now read-only.

deploy: org.apache.kafka.common.KafkaException: Failed to construct kafka consumer #804

Closed
gireeshpunathil opened this issue May 4, 2020 · 2 comments
Assignees
Labels
stack/java-spring-boot2 Issues related to java-spring-boot2 stack

Comments

@gireeshpunathil
Copy link
Contributor

Describe the bug
when deployed an appsody stack of type spring-boot2 kafka failed in openshift with the quoted error message

To Reproduce
Steps to reproduce the behavior:

  1. appsody init java-spring-boot2 kafka
  2. appsody run

Expected behavior
A clear and concise description of what you expected to happen.

the stack is booted up and running

Actual behaviour

[Container] 2020-05-04 13:07:44.982 ERROR 171 --- [  restartedMain] o.s.boot.SpringApplication               : Application run failed
[Container] 
[Container] 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
[Container] 	at org.springframework.context.support.DefaultLifecycleProcessor.doStart(DefaultLifecycleProcessor.java:185) ~[spring-context-5.1.13.RELEASE.jar:5.1.13.RELEASE]
[Container] 	at org.springframework.context.support.DefaultLifecycleProcessor.access$200(DefaultLifecycleProcessor.java:53) ~[spring-context-5.1.13.RELEASE.jar:5.1.13.RELEASE]
[Container] 	at org.springframework.context.support.DefaultLifecycleProcessor$LifecycleGroup.start(DefaultLifecycleProcessor.java:360) ~[spring-context-5.1.13.RELEASE.jar:5.1.13.RELEASE]
[Container] 	at org.springframework.context.support.DefaultLifecycleProcessor.startBeans(DefaultLifecycleProcessor.java:158) ~[spring-context-5.1.13.RELEASE.jar:5.1.13.RELEASE]
[Container] 	at org.springframework.context.support.DefaultLifecycleProcessor.onRefresh(DefaultLifecycleProcessor.java:122) ~[spring-context-5.1.13.RELEASE.jar:5.1.13.RELEASE]
[Container] 	at org.springframework.context.support.AbstractApplicationContext.finishRefresh(AbstractApplicationContext.java:893) ~[spring-context-5.1.13.RELEASE.jar:5.1.13.RELEASE]
[Container] 	at org.springframework.boot.web.servlet.context.ServletWebServerApplicationContext.finishRefresh(ServletWebServerApplicationContext.java:162) ~[spring-boot-2.1.12.RELEASE.jar:2.1.12.RELEASE]
[Container] 	at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:552) ~[spring-context-5.1.13.RELEASE.jar:5.1.13.RELEASE]
[Container] 	at org.springframework.boot.web.servlet.context.ServletWebServerApplicationContext.refresh(ServletWebServerApplicationContext.java:141) ~[spring-boot-2.1.12.RELEASE.jar:2.1.12.RELEASE]
[Container] 	at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:744) [spring-boot-2.1.12.RELEASE.jar:2.1.12.RELEASE]
[Container] 	at org.springframework.boot.SpringApplication.refreshContext(SpringApplication.java:391) [spring-boot-2.1.12.RELEASE.jar:2.1.12.RELEASE]
[Container] 	at org.springframework.boot.SpringApplication.run(SpringApplication.java:312) [spring-boot-2.1.12.RELEASE.jar:2.1.12.RELEASE]
[Container] 	at org.springframework.boot.SpringApplication.run(SpringApplication.java:1215) [spring-boot-2.1.12.RELEASE.jar:2.1.12.RELEASE]
[Container] 	at org.springframework.boot.SpringApplication.run(SpringApplication.java:1204) [spring-boot-2.1.12.RELEASE.jar:2.1.12.RELEASE]
[Container] 	at application.Main.main(Main.java:10) [classes/:na]
[Container] 	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[na:1.8.0_242]
[Container] 	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) ~[na:1.8.0_242]
[Container] 	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[na:1.8.0_242]
[Container] 	at java.lang.reflect.Method.invoke(Method.java:498) ~[na:1.8.0_242]
[Container] 	at org.springframework.boot.devtools.restart.RestartLauncher.run(RestartLauncher.java:49) [spring-boot-devtools-2.1.12.RELEASE.jar:2.1.12.RELEASE]
[Container] Caused by: org.apache.kafka.common.KafkaException: Failed to construct kafka consumer
[Container] 	at org.apache.kafka.clients.consumer.KafkaConsumer.<init>(KafkaConsumer.java:799) ~[kafka-clients-2.0.1.jar:na]
[Container] 	at org.apache.kafka.clients.consumer.KafkaConsumer.<init>(KafkaConsumer.java:615) ~[kafka-clients-2.0.1.jar:na]
[Container] 	at org.springframework.kafka.core.DefaultKafkaConsumerFactory.createKafkaConsumer(DefaultKafkaConsumerFactory.java:164) ~[spring-kafka-2.2.12.RELEASE.jar:2.2.12.RELEASE]
[Container] 	at org.springframework.kafka.core.DefaultKafkaConsumerFactory.createConsumerWithAdjustedProperties(DefaultKafkaConsumerFactory.java:160) ~[spring-kafka-2.2.12.RELEASE.jar:2.2.12.RELEASE]
[Container] 	at org.springframework.kafka.core.DefaultKafkaConsumerFactory.createKafkaConsumer(DefaultKafkaConsumerFactory.java:135) ~[spring-kafka-2.2.12.RELEASE.jar:2.2.12.RELEASE]
[Container] 	at org.springframework.kafka.core.DefaultKafkaConsumerFactory.createConsumer(DefaultKafkaConsumerFactory.java:109) ~[spring-kafka-2.2.12.RELEASE.jar:2.2.12.RELEASE]
[Container] 	at org.springframework.kafka.listener.AbstractMessageListenerContainer.checkTopics(AbstractMessageListenerContainer.java:300) ~[spring-kafka-2.2.12.RELEASE.jar:2.2.12.RELEASE]
[Container] 	at org.springframework.kafka.listener.ConcurrentMessageListenerContainer.doStart(ConcurrentMessageListenerContainer.java:136) ~[spring-kafka-2.2.12.RELEASE.jar:2.2.12.RELEASE]
[Container] 	at org.springframework.kafka.listener.AbstractMessageListenerContainer.start(AbstractMessageListenerContainer.java:292) ~[spring-kafka-2.2.12.RELEASE.jar:2.2.12.RELEASE]
[Container] 	at org.springframework.kafka.config.KafkaListenerEndpointRegistry.startIfNecessary(KafkaListenerEndpointRegistry.java:311) ~[spring-kafka-2.2.12.RELEASE.jar:2.2.12.RELEASE]
[Container] 	at org.springframework.kafka.config.KafkaListenerEndpointRegistry.start(KafkaListenerEndpointRegistry.java:255) ~[spring-kafka-2.2.12.RELEASE.jar:2.2.12.RELEASE]
[Container] 	at org.springframework.context.support.DefaultLifecycleProcessor.doStart(DefaultLifecycleProcessor.java:182) ~[spring-context-5.1.13.RELEASE.jar:5.1.13.RELEASE]
[Container] 	... 19 common frames omitted
[Container] Caused by: org.apache.kafka.common.config.ConfigException: Invalid url in bootstrap.servers: ${KAFKA_BOOTSTRAP_SERVERS}
[Container] 	at org.apache.kafka.clients.ClientUtils.parseAndValidateAddresses(ClientUtils.java:51) ~[kafka-clients-2.0.1.jar:na]
[Container] 	at org.apache.kafka.clients.consumer.KafkaConsumer.<init>(KafkaConsumer.java:709) ~[kafka-clients-2.0.1.jar:na]
[Container] 	... 30 common frames omitted

Environment Details (please complete the following information):

  • OS: mac os
  • Browser [e.g. chrome, safari]
  • Version [e.g. 22]

If applicable please specify:

  • CLI version: 0.6.1
  • Stack you are using (including the version):

spring-boot2 kafka

Screenshots
If applicable, add screenshots to help explain your problem.

Additional context
Add any other context about the problem here.

afterwards, the log showed:

[Container] 
[Container] [INFO] ------------------------------------------------------------------------
[Container] [INFO] BUILD SUCCESS
[Container] [INFO] ------------------------------------------------------------------------
[Container] [INFO] Total time:  01:34 min
[Container] [INFO] Finished at: 2020-05-04T13:07:45Z
[Container] [INFO] ------------------------------------------------------------------------

not sure what that means

we are building solution builder that builds deployment descriptors and stack images from a graphics based user input. the failure actually was reported when we deployed the generated yaml.

@ianpartridge
Copy link
Contributor

I think this is probably because you haven't defined KAFKA_BOOTSTRAP_SERVERS to point at the address of your Kafka.

See the README here: https://github.com/appsody/stacks/tree/master/incubator/java-spring-boot2/templates/kafka

@neeraj-laad neeraj-laad added the stack/java-spring-boot2 Issues related to java-spring-boot2 stack label May 5, 2020
@gireeshpunathil
Copy link
Contributor Author

following the above suggestion solves the issue; thanks!

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
stack/java-spring-boot2 Issues related to java-spring-boot2 stack
Projects
None yet
Development

No branches or pull requests

4 participants