Spring Cloud Stream - Kafka Binder集成/配置

时间:2017-02-10 00:21:19

标签: spring spring-cloud

尝试使用Spring云流与Kafka集成发布,订阅实现 构建成功, 在启动时它无法找到所需的类。你可以帮忙,以下配置中缺少什么。还提供了堆栈跟踪错误。

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)

1 个答案:

答案 0 :(得分:1)

您是否提供了自己的spring.binders文件,内容为META-INF/spring.binders: spring.cloud.stream.binders.kafka.defaultCandidate=true

如果是,你应该删除它。