spring cloud stream 'bindingService' error

19,504

Solution 1

Add this to your pom under dependencies,

<dependency>
    <groupId>org.springframework.cloud</groupId>
    <artifactId>spring-cloud-starter-stream-rabbit</artifactId>
</dependency>

This is for RabbitMQ binder

Solution 2

Check whether you have Spring Cloud Stream rabbit binder dependency in your classpath. The binder is responsible for binding the spring-cloud-stream channels to your message broker.

For rabbit: org.springframework.cloud:spring-cloud-stream-binder-rabbit:version

Share:
19,504
Grinish Nepal
Author by

Grinish Nepal

Software Engineer

Updated on June 04, 2022

Comments

  • Grinish Nepal
    Grinish Nepal almost 2 years

    I am trying to implement Turbine AMQP to consolidate all the stream from multiple services to Hystrix Dashboard.

    So I added couple fo dependencies to the gradle file and after that I am not able to start my application for some reason.

    LOGS from startup where i see the exception.

    [LogMessage=Application startup failed]
    org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'bindingService' defined in class path resource [org/springframework/cloud/stream/config/ChannelBindingServiceConfiguration.class]: Unsatisfied dependency expressed through constructor argument with index 1 of type [org.springframework.cloud.stream.binder.BinderFactory]: Error creating bean with name 'binderFactory' defined in class path resource [org/springframework/cloud/stream/config/BinderFactoryConfiguration.class]: Unsatisfied dependency expressed through constructor argument with index 0 of type [org.springframework.cloud.stream.binder.BinderTypeRegistry]: 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, no `META-INF/spring.binders` resources found on the classpath; nested exception is 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, no `META-INF/spring.binders` resources found on the classpath; nested exception is org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'binderFactory' defined in class path resource [org/springframework/cloud/stream/config/BinderFactoryConfiguration.class]: Unsatisfied dependency expressed through constructor argument with index 0 of type [org.springframework.cloud.stream.binder.BinderTypeRegistry]: 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, no `META-INF/spring.binders` resources found on the classpath; nested exception is 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, no `META-INF/spring.binders` resources found on the classpath
        at org.springframework.beans.factory.support.ConstructorResolver.createArgumentArray(ConstructorResolver.java:749) ~[spring-beans-4.2.5.RELEASE.jar:4.2.5.RELEASE]
        at org.springframework.beans.factory.support.ConstructorResolver.instantiateUsingFactoryMethod(ConstructorResolver.java:464) ~[spring-beans-4.2.5.RELEASE.jar:4.2.5.RELEASE]
        at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.instantiateUsingFactoryMethod(AbstractAutowireCapableBeanFactory.java:1123) ~[spring-beans-4.2.5.RELEASE.jar:4.2.5.RELEASE]
        at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBeanInstance(AbstractAutowireCapableBeanFactory.java:1018) ~[spring-beans-4.2.5.RELEASE.jar:4.2.5.RELEASE]
        at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:510) ~[spring-beans-4.2.5.RELEASE.jar:4.2.5.RELEASE]
        at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:482) ~[spring-beans-4.2.5.RELEASE.jar:4.2.5.RELEASE]
        at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:306) ~[spring-beans-4.2.5.RELEASE.jar:4.2.5.RELEASE]
        at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:230) ~[spring-beans-4.2.5.RELEASE.jar:4.2.5.RELEASE]
        at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:302) ~[spring-beans-4.2.5.RELEASE.jar:4.2.5.RELEASE]
        at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:197) ~[spring-beans-4.2.5.RELEASE.jar:4.2.5.RELEASE]
        at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:772) ~[spring-beans-4.2.5.RELEASE.jar:4.2.5.RELEASE]
        at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:839) ~[spring-context-4.2.5.RELEASE.jar:4.2.5.RELEASE]
        at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:538) ~[spring-context-4.2.5.RELEASE.jar:4.2.5.RELEASE]
        at org.springframework.boot.context.embedded.EmbeddedWebApplicationContext.refresh(EmbeddedWebApplicationContext.java:118) ~[spring-boot-1.3.2.RELEASE.jar:1.3.2.RELEASE]
        at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:766) [spring-boot-1.3.2.RELEASE.jar:1.3.2.RELEASE]
        at org.springframework.boot.SpringApplication.createAndRefreshContext(SpringApplication.java:361) [spring-boot-1.3.2.RELEASE.jar:1.3.2.RELEASE]
        at org.springframework.boot.SpringApplication.run(SpringApplication.java:307) [spring-boot-1.3.2.RELEASE.jar:1.3.2.RELEASE]
        at org.springframework.boot.SpringApplication.run(SpringApplication.java:1191) [spring-boot-1.3.2.RELEASE.jar:1.3.2.RELEASE]
        at org.springframework.boot.SpringApplication.run(SpringApplication.java:1180) [spring-boot-1.3.2.RELEASE.jar:1.3.2.RELEASE]
        at com.bbtransact.icp.api.associations.boot.UserApplication.main(UserApplication.java:20) [bin/:na]
    
    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, no `META-INF/spring.binders` resources found on the classpath
        at org.springframework.beans.factory.support.ConstructorResolver.instantiateUsingFactoryMethod(ConstructorResolver.java:599) ~[spring-beans-4.2.5.RELEASE.jar:4.2.5.RELEASE]
        at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.instantiateUsingFactoryMethod(AbstractAutowireCapableBeanFactory.java:1123) ~[spring-beans-4.2.5.RELEASE.jar:4.2.5.RELEASE]
        at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBeanInstance(AbstractAutowireCapableBeanFactory.java:1018) ~[spring-beans-4.2.5.RELEASE.jar:4.2.5.RELEASE]
        at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:510) ~[spring-beans-4.2.5.RELEASE.jar:4.2.5.RELEASE]
        at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:482) ~[spring-beans-4.2.5.RELEASE.jar:4.2.5.RELEASE]
        at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:306) ~[spring-beans-4.2.5.RELEASE.jar:4.2.5.RELEASE]
        at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:230) ~[spring-beans-4.2.5.RELEASE.jar:4.2.5.RELEASE]
        at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:302) ~[spring-beans-4.2.5.RELEASE.jar:4.2.5.RELEASE]
        at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:197) ~[spring-beans-4.2.5.RELEASE.jar:4.2.5.RELEASE]
        at org.springframework.beans.factory.support.DefaultListableBeanFactory.findAutowireCandidates(DefaultListableBeanFactory.java:1192) ~[spring-beans-4.2.5.RELEASE.jar:4.2.5.RELEASE]
        at org.springframework.beans.factory.support.DefaultListableBeanFactory.doResolveDependency(DefaultListableBeanFactory.java:1116) ~[spring-beans-4.2.5.RELEASE.jar:4.2.5.RELEASE]
        at org.springframework.beans.factory.support.DefaultListableBeanFactory.resolveDependency(DefaultListableBeanFactory.java:1014) ~[spring-beans-4.2.5.RELEASE.jar:4.2.5.RELEASE]
        at org.springframework.beans.factory.support.ConstructorResolver.resolveAutowiredArgument(ConstructorResolver.java:813) ~[spring-beans-4.2.5.RELEASE.jar:4.2.5.RELEASE]
        at org.springframework.beans.factory.support.ConstructorResolver.createArgumentArray(ConstructorResolver.java:741) ~[spring-beans-4.2.5.RELEASE.jar:4.2.5.RELEASE]
        ... 33 common frames omitted
    Caused by: 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, no `META-INF/spring.binders` resources found on the classpath
        at org.springframework.beans.factory.support.SimpleInstantiationStrategy.instantiate(SimpleInstantiationStrategy.java:189) ~[spring-beans-4.2.5.RELEASE.jar:4.2.5.RELEASE]
        at org.springframework.beans.factory.support.ConstructorResolver.instantiateUsingFactoryMethod(ConstructorResolver.java:588) ~[spring-beans-4.2.5.RELEASE.jar:4.2.5.RELEASE]
        ... 46 common frames omitted
    Caused by: org.springframework.beans.factory.BeanCreationException: Cannot create binder factory, no `META-INF/spring.binders` resources found on the classpath
        at org.springframework.cloud.stream.config.BinderFactoryConfiguration.binderTypeRegistry(BinderFactoryConfiguration.java:100) ~[spring-cloud-stream-1.0.0.RC1.jar:1.0.0.RC1]
        at org.springframework.cloud.stream.config.BinderFactoryConfiguration$$EnhancerBySpringCGLIB$$b9b6d96.CGLIB$binderTypeRegistry$1(<generated>) ~[spring-cloud-stream-1.0.0.RC1.jar:1.0.0.RC1]
        at org.springframework.cloud.stream.config.BinderFactoryConfiguration$$EnhancerBySpringCGLIB$$b9b6d96$$FastClassBySpringCGLIB$$d1bb81f1.invoke(<generated>) ~[spring-cloud-stream-1.0.0.RC1.jar:1.0.0.RC1]
        at org.springframework.cglib.proxy.MethodProxy.invokeSuper(MethodProxy.java:228) ~[spring-core-4.2.4.RELEASE.jar:4.2.4.RELEASE]
        at org.springframework.context.annotation.ConfigurationClassEnhancer$BeanMethodInterceptor.intercept(ConfigurationClassEnhancer.java:355) ~[spring-context-4.2.5.RELEASE.jar:4.2.5.RELEASE]
        at org.springframework.cloud.stream.config.BinderFactoryConfiguration$$EnhancerBySpringCGLIB$$b9b6d96.binderTypeRegistry(<generated>) ~[spring-cloud-stream-1.0.0.RC1.jar:1.0.0.RC1]
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[na:1.8.0_66]
        at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) ~[na:1.8.0_66]
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) ~[na:1.8.0_66]
        at java.lang.reflect.Method.invoke(Unknown Source) ~[na:1.8.0_66]
        at org.springframework.beans.factory.support.SimpleInstantiationStrategy.instantiate(SimpleInstantiationStrategy.java:162) ~[spring-beans-4.2.5.RELEASE.jar:4.2.5.RELEASE]
    

    Here is my .Gradle I added dependencies for hystrix, hystrix-ampqp,starter-bus-amqp.

    buildscript {
    
        ext {
            springBootVersion = '1.3.0.RELEASE'
        }
    
        repositories {
            maven {
                url "https://plugins.gradle.org/m2/"
            }
            mavenLocal()
            mavenCentral()
    }
    
        dependencies {
            classpath ("org.springframework.boot:spring-boot-gradle-plugin:${springBootVersion}") 
            classpath ("io.spring.gradle:dependency-management-plugin:0.5.2.RELEASE")
            classpath ("mysql:mysql-connector-java:5.1.34")
            classpath ("org.sonarqube.gradle:gradle-sonarqube-plugin:1.1")
        }
    }
    
    repositories {
            maven {
                url "https://plugins.gradle.org/m2/"
                url "https://repo.spring.io/snapshot"
                url "https://repo.spring.io/milestone"
            }
            mavenLocal()
            mavenCentral()
    }
    
    
    apply plugin: 'java'
    apply plugin: 'eclipse-wtp'
    apply plugin: 'idea'
    apply plugin: 'spring-boot' 
    apply plugin: 'io.spring.dependency-management' 
    apply plugin: 'org.sonarqube'
    apply plugin: "jacoco"
    apply plugin: "sonar-runner"
    
    
    group    = 'com.api'
    
    def build_version=project.properties['build_version'] ?: "SNAPSHOT"
    version  = "${build_version}"
    
    ext.packaging = 'jar'
    
    jar {
       baseName = "userassociations-v1"
    }
    
    
    sourceCompatibility = 1.8
    targetCompatibility = 1.8
    
    sourceSets {
        generated {
            java {
                srcDirs = ['src/main/generated']
            }
        }
    }
    
    
    configurations {
        providedRuntime
         querydslapt
    }
    
    jacoco {
    
        reportsDir = file("build/tmp/jacoco.exec")
    }
    
    test{
        ignoreFailures = true    
    }
    
    sonarqube {
      properties {
        property "sonar.projectName", "User-associations-V1"
        property "sonar.projectKey", "org.sonarqube:User-associations-V1"
        property "sonar.sourceEncoding", "UTF-8"
        property "sonar.host.url", "${sonar_host}"
        property "sonar.login", "${sonar_username}"
        property "sonar.password", "${sonar_password}"
        property "sonar.jacoco.reportPath", "build/jacoco/test.exec"
        property "sonar.java.source property", "1.8"
    
      }
    }
    
    dependencyManagement {
        imports { 
            mavenBom "org.springframework.cloud:spring-cloud-starter-parent:Brixton.RC1" 
        }
    }
    
    dependencies {
        compile         ("org.springframework.boot:spring-boot-starter-actuator")
        compile         ("org.springframework.cloud:spring-cloud-starter-eureka")
        compile         ("org.springframework.cloud:spring-cloud-config-client")
        compile("org.springframework.cloud:spring-cloud-starter-hystrix:1.0.6.RELEASE")
        compile("org.springframework.cloud:spring-cloud-starter-bus-amqp:1.0.6.RELEASE")
        compile("org.springframework.cloud:spring-cloud-netflix-hystrix-amqp:1.0.6.RELEASE")
        compile         ("org.codehaus.sonar-plugins.java:sonar-jacoco-plugin:2.3")
        compile         ("org.springframework.boot:spring-boot-starter-web")
        compile         ("org.codehaus.jackson:jackson-mapper-asl:1.9.2")
        compile         ("mysql:mysql-connector-java:5.1.34")
        compile         ("org.springframework:spring-webmvc:4.2.2.RELEASE")
        compile         ("org.springframework.boot:spring-boot-starter-data-jpa")
        providedRuntime ("org.springframework.boot:spring-boot-starter-tomcat")
        testCompile     ("org.springframework.boot:spring-boot-starter-test") 
        querydslapt     ("org.hibernate:hibernate-jpamodelgen:5.0.5.Final")
        compile 'org.springframework.cloud:spring-cloud-starter-sleuth:1.0.0.M1'
        compile 'org.springframework.cloud:spring-cloud-sleuth-core:1.0.0.M1' 
    }
    
    
    eclipse {
        classpath {
             containers.remove('org.eclipse.jdt.launching.JRE_CONTAINER')
             containers ('org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.8')
        }
    }
    
    task generateQueryDSL(type: JavaCompile, group: 'build', description: 'Generates the QueryDSL query types') {
        source = sourceSets.main.java
        classpath = configurations.compile + configurations.querydslapt
        options.compilerArgs = [
                "-proc:only"
        ]
        destinationDir = sourceSets.generated.java.srcDirs.iterator().next()
    }
    
    compileJava {
        dependsOn generateQueryDSL
        source generateQueryDSL.destinationDir
    }
    
    compileGeneratedJava {
        dependsOn generateQueryDSL
        options.warnings = false
        classpath += sourceSets.main.runtimeClasspath
    }
    
    clean {
        delete sourceSets.generated.java.srcDirs
    }
    
    task wrapper(type: Wrapper) {
        gradleVersion = '2.9'
    }
    

    Any help is appreciated I have stuck in this for a while now.