Rajashekhar Sheela
Rajashekhar Sheela

Reputation: 11

Spring Cloud Stream - Kafka Binder integration / configuration

Trying to integrate with Kafka for Publish, Subscribe implementation using Spring cloud stream.
Build is being successful, while startup it could not find the required class. Can you help, what is missing from the following configuration. Also provided error the stack trace.

pom.xml
=========
 <dependency>
            <groupId>org.springframework.cloud</groupId>
            <artifactId>spring-cloud-stream-binder-kafka</artifactId>
        </dependency>

Jar contents
============
There are no multiple binders.  
- META-INF/spring.binders: spring.cloud.stream.binders.kafka.defaultCandidate=true
- Kafka binaries included 

spring-cloud-starter-stream-kafka-1.1.0.RELEASE.jar
spring-kafka-1.0.4.RELEASE.jar
spring-integration-kafka-2.0.1.RELEASE.jar
kafka_2.11-0.9.0.1.jar
spring-cloud-stream-binder-kafka-1.1.0.RELEASE.jar
kafka-clients-0.9.0.1.jar

Error Stack
========


     Caused by: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'binderTypeRegistry' defined in class path resource [org/springframework/cloud/stream/config/BinderFactoryConfiguration.class]: Bean instantiation via factory method failed; nested exception is org.springframework.beans.BeanInstantiationException: Failed to instantiate [org.springframework.cloud.stream.binder.BinderTypeRegistry]: Factory method 'binderTypeRegistry' threw exception; nested exception is org.springframework.beans.factory.BeanCreationException: Cannot create binder factory:; nested exception is java.lang.ClassNotFoundException: false
    at org.springframework.beans.factory.support.ConstructorResolver.instantiateUsingFactoryMethod(ConstructorResolver.java:599)
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.instantiateUsingFactoryMethod(AbstractAutowireCapableBeanFactory.java:1134)
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBeanInstance(AbstractAutowireCapableBeanFactory.java:1028)
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:513)
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:483)
    at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:306)
    at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:230)
    at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:302)
    at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:202)
    at org.springframework.beans.factory.config.DependencyDescriptor.resolveCandidate(DependencyDescriptor.java:207)
    at org.springframework.beans.factory.support.DefaultListableBeanFactory.doResolveDependency(DefaultListableBeanFactory.java:1136)
    at org.springframework.beans.factory.support.DefaultListableBeanFactory.resolveDependency(DefaultListableBeanFactory.java:1064)

Upvotes: 0

Views: 1073

Answers (1)

Marius Bogoevici
Marius Bogoevici

Reputation: 2400

Do you provide your own spring.binders file with the content META-INF/spring.binders: spring.cloud.stream.binders.kafka.defaultCandidate=true?

If yes, you should remove that.

Upvotes: 1

Related Questions