springcloud集成stream

来源:7-4 Spring Cloud Stream的使用(上)

ly_simon

2020-06-16

图片描述
图片描述
图片描述
流程和老师一模一样 input和output 名字一样 启动就报错 如果不一样 发送两次 消息 接收方 只能收到一次 ~ 这是 啥原因啊 老师

上面报错 提示 是JDK 里面包 和 mq里面的包 冲突了 有啥解决办法么

下面是具体的报错

[2020-06-16 23:31:37.814] [main] [WARN ] o.s.b.w.s.c.AnnotationConfigServletWebServerApplicationContext - Exception encountered during context initialization - cancelling refresh attempt: org.springframework.beans.factory.BeanDefinitionStoreException: Invalid bean definition with name ‘inputMess’ defined in com.ali.service.StreamClient: bean definition with this name already exists - Root bean: class [null]; scope=; abstract=false; lazyInit=false; autowireMode=0; dependencyCheck=0; autowireCandidate=true; primary=false; factoryBeanName=com.ali.service.StreamClient; factoryMethodName=input; initMethodName=null; destroyMethodName=null
[2020-06-16 23:31:37.814] [main] [DEBUG] o.s.b.c.l.ClasspathLoggingApplicationListener - Application failed to start with classpath: [file:/H:/jdk/jre/lib/charsets.jar, file:/H:/jdk/jre/lib/deploy.jar, file:/H:/jdk/jre/lib/ext/access-bridge-64.jar, file:/H:/jdk/jre/lib/ext/cldrdata.jar, file:/H:/jdk/jre/lib/ext/dnsns.jar, file:/H:/jdk/jre/lib/ext/jaccess.jar, file:/H:/jdk/jre/lib/ext/jfxrt.jar, file:/H:/jdk/jre/lib/ext/localedata.jar, file:/H:/jdk/jre/lib/ext/nashorn.jar, file:/H:/jdk/jre/lib/ext/sunec.jar, file:/H:/jdk/jre/lib/ext/sunjce_provider.jar, file:/H:/jdk/jre/lib/ext/sunmscapi.jar, file:/H:/jdk/jre/lib/ext/sunpkcs11.jar, file:/H:/jdk/jre/lib/ext/zipfs.jar, file:/H:/jdk/jre/lib/javaws.jar, file:/H:/jdk/jre/lib/jce.jar, file:/H:/jdk/jre/lib/jfr.jar, file:/H:/jdk/jre/lib/jfxswt.jar, file:/H:/jdk/jre/lib/jsse.jar, file:/H:/jdk/jre/lib/management-agent.jar, file:/H:/jdk/jre/lib/plugin.jar, file:/H:/jdk/jre/lib/resources.jar, file:/H:/jdk/jre/lib/rt.jar, file:/L:/idea_work/e-rabbitmq/e-provider/target/classes/, file:/L:/idea_work/e-rabbitmq/e-base/target/classes/, file:/J:/maven/config/org/springframework/cloud/spring-cloud-config-client/2.1.6.RELEASE/spring-cloud-config-client-2.1.6.RELEASE.jar, file:/J:/maven/config/org/springframework/boot/spring-boot-autoconfigure/2.1.14.RELEASE/spring-boot-autoconfigure-2.1.14.RELEASE.jar, file:/J:/maven/config/org/springframework/boot/spring-boot/2.1.14.RELEASE/spring-boot-2.1.14.RELEASE.jar, file:/J:/maven/config/org/springframework/cloud/spring-cloud-commons/2.1.5.RELEASE/spring-cloud-commons-2.1.5.RELEASE.jar, file:/J:/maven/config/org/springframework/security/spring-security-crypto/5.1.10.RELEASE/spring-security-crypto-5.1.10.RELEASE.jar, file:/J:/maven/config/org/springframework/cloud/spring-cloud-context/2.1.5.RELEASE/spring-cloud-context-2.1.5.RELEASE.jar, file:/J:/maven/config/org/springframework/spring-web/5.1.15.RELEASE/spring-web-5.1.15.RELEASE.jar, file:/J:/maven/config/org/springframework/spring-beans/5.1.15.RELEASE/spring-beans-5.1.15.RELEASE.jar, file:/J:/maven/config/com/fasterxml/jackson/core/jackson-annotations/2.9.10/jackson-annotations-2.9.10.jar, file:/J:/maven/config/com/fasterxml/jackson/core/jackson-databind/2.9.10.4/jackson-databind-2.9.10.4.jar, file:/J:/maven/config/com/fasterxml/jackson/core/jackson-core/2.9.10/jackson-core-2.9.10.jar, file:/J:/maven/config/org/springframework/boot/spring-boot-starter-amqp/2.1.14.RELEASE/spring-boot-starter-amqp-2.1.14.RELEASE.jar, file:/J:/maven/config/org/springframework/boot/spring-boot-starter/2.1.14.RELEASE/spring-boot-starter-2.1.14.RELEASE.jar, file:/J:/maven/config/org/springframework/boot/spring-boot-starter-logging/2.1.14.RELEASE/spring-boot-starter-logging-2.1.14.RELEASE.jar, file:/J:/maven/config/ch/qos/logback/logback-classic/1.2.3/logback-classic-1.2.3.jar, file:/J:/maven/config/ch/qos/logback/logback-core/1.2.3/logback-core-1.2.3.jar, file:/J:/maven/config/org/apache/logging/log4j/log4j-to-slf4j/2.11.2/log4j-to-slf4j-2.11.2.jar, file:/J:/maven/config/org/apache/logging/log4j/log4j-api/2.11.2/log4j-api-2.11.2.jar, file:/J:/maven/config/org/slf4j/jul-to-slf4j/1.7.30/jul-to-slf4j-1.7.30.jar, file:/J:/maven/config/javax/annotation/javax.annotation-api/1.3.2/javax.annotation-api-1.3.2.jar, file:/J:/maven/config/org/yaml/snakeyaml/1.23/snakeyaml-1.23.jar, file:/J:/maven/config/org/springframework/spring-messaging/5.1.15.RELEASE/spring-messaging-5.1.15.RELEASE.jar, file:/J:/maven/config/org/springframework/amqp/spring-rabbit/2.1.14.RELEASE/spring-rabbit-2.1.14.RELEASE.jar, file:/J:/maven/config/com/rabbitmq/amqp-client/5.4.3/amqp-client-5.4.3.jar, file:/J:/maven/config/org/springframework/amqp/spring-amqp/2.1.14.RELEASE/spring-amqp-2.1.14.RELEASE.jar, file:/J:/maven/config/org/springframework/retry/spring-retry/1.2.5.RELEASE/spring-retry-1.2.5.RELEASE.jar, file:/J:/maven/config/org/springframework/spring-context/5.1.15.RELEASE/spring-context-5.1.15.RELEASE.jar, file:/J:/maven/config/org/springframework/spring-tx/5.1.15.RELEASE/spring-tx-5.1.15.RELEASE.jar, file:/J:/maven/config/org/springframework/cloud/spring-cloud-starter-stream-rabbit/2.1.4.RELEASE/spring-cloud-starter-stream-rabbit-2.1.4.RELEASE.jar, file:/J:/maven/config/org/springframework/cloud/spring-cloud-stream-binder-rabbit/2.1.4.RELEASE/spring-cloud-stream-binder-rabbit-2.1.4.RELEASE.jar, file:/J:/maven/config/org/springframework/cloud/spring-cloud-stream-binder-rabbit-core/2.1.4.RELEASE/spring-cloud-stream-binder-rabbit-core-2.1.4.RELEASE.jar, file:/J:/maven/config/com/rabbitmq/http-client/2.1.0.RELEASE/http-client-2.1.0.RELEASE.jar, file:/J:/maven/config/org/springframework/cloud/spring-cloud-stream/2.1.4.RELEASE/spring-cloud-stream-2.1.4.RELEASE.jar, file:/J:/maven/config/org/springframework/boot/spring-boot-starter-validation/2.1.14.RELEASE/spring-boot-starter-validation-2.1.14.RELEASE.jar, file:/J:/maven/config/org/springframework/spring-tuple/1.0.0.RELEASE/spring-tuple-1.0.0.RELEASE.jar, file:/J:/maven/config/com/esotericsoftware/kryo-shaded/3.0.3/kryo-shaded-3.0.3.jar, file:/J:/maven/config/com/esotericsoftware/minlog/1.3.0/minlog-1.3.0.jar, file:/J:/maven/config/org/springframework/integration/spring-integration-tuple/1.0.0.RELEASE/spring-integration-tuple-1.0.0.RELEASE.jar, file:/J:/maven/config/org/springframework/cloud/spring-cloud-function-context/2.0.2.RELEASE/spring-cloud-function-context-2.0.2.RELEASE.jar, file:/J:/maven/config/org/springframework/cloud/spring-cloud-function-core/2.0.2.RELEASE/spring-cloud-function-core-2.0.2.RELEASE.jar, file:/J:/maven/config/org/springframework/integration/spring-integration-amqp/5.1.10.RELEASE/spring-integration-amqp-5.1.10.RELEASE.jar, file:/J:/maven/config/org/springframework/integration/spring-integration-core/5.1.10.RELEASE/spring-integration-core-5.1.10.RELEASE.jar, file:/J:/maven/config/io/projectreactor/reactor-core/3.2.17.RELEASE/reactor-core-3.2.17.RELEASE.jar, file:/J:/maven/config/org/reactivestreams/reactive-streams/1.0.3/reactive-streams-1.0.3.jar, file:/J:/maven/config/org/springframework/integration/spring-integration-jmx/5.1.10.RELEASE/spring-integration-jmx-5.1.10.RELEASE.jar, file:/J:/maven/config/org/springframework/cloud/spring-cloud-starter/2.1.5.RELEASE/spring-cloud-starter-2.1.5.RELEASE.jar, file:/J:/maven/config/org/springframework/security/spring-security-rsa/1.0.9.RELEASE/spring-security-rsa-1.0.9.RELEASE.jar, file:/J:/maven/config/org/bouncycastle/bcpkix-jdk15on/1.64/bcpkix-jdk15on-1.64.jar, file:/J:/maven/config/org/bouncycastle/bcprov-jdk15on/1.64/bcprov-jdk15on-1.64.jar, file:/J:/maven/config/org/springframework/boot/spring-boot-starter-web/2.1.14.RELEASE/spring-boot-starter-web-2.1.14.RELEASE.jar, file:/J:/maven/config/org/springframework/boot/spring-boot-starter-json/2.1.14.RELEASE/spring-boot-starter-json-2.1.14.RELEASE.jar, file:/J:/maven/config/com/fasterxml/jackson/datatype/jackson-datatype-jdk8/2.9.10/jackson-datatype-jdk8-2.9.10.jar, file:/J:/maven/config/com/fasterxml/jackson/datatype/jackson-datatype-jsr310/2.9.10/jackson-datatype-jsr310-2.9.10.jar, file:/J:/maven/config/com/fasterxml/jackson/module/jackson-module-parameter-names/2.9.10/jackson-module-parameter-names-2.9.10.jar, file:/J:/maven/config/org/springframework/boot/spring-boot-starter-tomcat/2.1.14.RELEASE/spring-boot-starter-tomcat-2.1.14.RELEASE.jar, file:/J:/maven/config/org/apache/tomcat/embed/tomcat-embed-core/9.0.34/tomcat-embed-core-9.0.34.jar, file:/J:/maven/config/org/apache/tomcat/embed/tomcat-embed-el/9.0.34/tomcat-embed-el-9.0.34.jar, file:/J:/maven/config/org/apache/tomcat/embed/tomcat-embed-websocket/9.0.34/tomcat-embed-websocket-9.0.34.jar, file:/J:/maven/config/org/hibernate/validator/hibernate-validator/6.0.19.Final/hibernate-validator-6.0.19.Final.jar, file:/J:/maven/config/javax/validation/validation-api/2.0.1.Final/validation-api-2.0.1.Final.jar, file:/J:/maven/config/org/jboss/logging/jboss-logging/3.3.3.Final/jboss-logging-3.3.3.Final.jar, file:/J:/maven/config/com/fasterxml/classmate/1.4.0/classmate-1.4.0.jar, file:/J:/maven/config/org/springframework/spring-webmvc/5.1.15.RELEASE/spring-webmvc-5.1.15.RELEASE.jar, file:/J:/maven/config/org/springframework/spring-aop/5.1.15.RELEASE/spring-aop-5.1.15.RELEASE.jar, file:/J:/maven/config/org/springframework/spring-expression/5.1.15.RELEASE/spring-expression-5.1.15.RELEASE.jar, file:/J:/maven/config/org/projectlombok/lombok/1.18.12/lombok-1.18.12.jar, file:/J:/maven/config/org/slf4j/slf4j-api/1.7.30/slf4j-api-1.7.30.jar, file:/J:/maven/config/junit/junit/4.12/junit-4.12.jar, file:/J:/maven/config/org/objenesis/objenesis/2.6/objenesis-2.6.jar, file:/J:/maven/config/org/hamcrest/hamcrest-core/1.3/hamcrest-core-1.3.jar, file:/J:/maven/config/org/springframework/spring-core/5.1.15.RELEASE/spring-core-5.1.15.RELEASE.jar, file:/J:/maven/config/org/springframework/spring-jcl/5.1.15.RELEASE/spring-jcl-5.1.15.RELEASE.jar, file:/J:/maven/config/org/mybatis/mybatis-spring/1.3.2/mybatis-spring-1.3.2.jar, file:/J:/maven/config/mysql/mysql-connector-java/8.0.13/mysql-connector-java-8.0.13.jar, file:/J:/maven/config/com/alibaba/druid/1.1.12/druid-1.1.12.jar, file:/J:/maven/config/com/github/pagehelper/pagehelper-spring-boot-starter/1.2.5/pagehelper-spring-boot-starter-1.2.5.jar, file:/J:/maven/config/org/mybatis/spring/boot/mybatis-spring-boot-starter/1.3.2/mybatis-spring-boot-starter-1.3.2.jar, file:/J:/maven/config/org/springframework/boot/spring-boot-starter-jdbc/2.1.14.RELEASE/spring-boot-starter-jdbc-2.1.14.RELEASE.jar, file:/J:/maven/config/com/zaxxer/HikariCP/3.2.0/HikariCP-3.2.0.jar, file:/J:/maven/config/org/springframework/spring-jdbc/5.1.15.RELEASE/spring-jdbc-5.1.15.RELEASE.jar, file:/J:/maven/config/org/mybatis/spring/boot/mybatis-spring-boot-autoconfigure/1.3.2/mybatis-spring-boot-autoconfigure-1.3.2.jar, file:/J:/maven/config/org/mybatis/mybatis/3.4.6/mybatis-3.4.6.jar, file:/J:/maven/config/com/github/pagehelper/pagehelper-spring-boot-autoconfigure/1.2.5/pagehelper-spring-boot-autoconfigure-1.2.5.jar, file:/J:/maven/config/com/github/pagehelper/pagehelper/5.1.4/pagehelper-5.1.4.jar, file:/J:/maven/config/com/github/jsqlparser/jsqlparser/1.0/jsqlparser-1.0.jar, file:/J:/maven/config/com/alibaba/fastjson/1.1.41/fastjson-1.1.41.jar, file:/J:/maven/config/com/github/theborakompanioni/thymeleaf-extras-shiro/1.2.1/thymeleaf-extras-shiro-1.2.1.jar, file:/J:/maven/config/org/springframework/boot/spring-boot-starter-thymeleaf/2.1.14.RELEASE/spring-boot-starter-thymeleaf-2.1.14.RELEASE.jar, file:/J:/maven/config/org/thymeleaf/thymeleaf-spring5/3.0.11.RELEASE/thymeleaf-spring5-3.0.11.RELEASE.jar, file:/J:/maven/config/org/thymeleaf/thymeleaf/3.0.11.RELEASE/thymeleaf-3.0.11.RELEASE.jar, file:/J:/maven/config/org/attoparser/attoparser/2.0.5.RELEASE/attoparser-2.0.5.RELEASE.jar, file:/J:/maven/config/org/unbescape/unbescape/1.1.6.RELEASE/unbescape-1.1.6.RELEASE.jar, file:/J:/maven/config/org/thymeleaf/extras/thymeleaf-extras-java8time/3.0.4.RELEASE/thymeleaf-extras-java8time-3.0.4.RELEASE.jar, file:/J:/maven/config/commons-logging/commons-logging/1.2/commons-logging-1.2.jar, file:/J:/maven/config/org/apache/httpcomponents/fluent-hc/4.3.5/fluent-hc-4.3.5.jar, file:/J:/maven/config/org/apache/httpcomponents/httpclient/4.5.12/httpclient-4.5.12.jar, file:/J:/maven/config/org/apache/httpcomponents/httpcore/4.3.2/httpcore-4.3.2.jar, file:/J:/maven/config/org/apache/httpcomponents/httpclient-cache/4.3.5/httpclient-cache-4.3.5.jar, file:/J:/maven/config/commons-httpclient/commons-httpclient/3.0.1/commons-httpclient-3.0.1.jar, file:/J:/maven/config/commons-pool/commons-pool/1.5.2/commons-pool-1.5.2.jar, file:/J:/maven/config/commons-dbcp/commons-dbcp/1.2.2/commons-dbcp-1.2.2.jar, file:/J:/maven/config/commons-discovery/commons-discovery/0.5/commons-discovery-0.5.jar, file:/J:/maven/config/commons-collections/commons-collections/3.2/commons-collections-3.2.jar, file:/J:/maven/config/commons-fileupload/commons-fileupload/1.3.1/commons-fileupload-1.3.1.jar, file:/J:/maven/config/commons-io/commons-io/2.2/commons-io-2.2.jar, file:/J:/maven/config/commons-codec/commons-codec/1.9/commons-codec-1.9.jar, file:/K:/idea/IntelliJ%20IDEA%202018.1.3/lib/idea_rt.jar, file:/C:/Users/ly092/.IntelliJIdea2018.1/system/captureAgent/debugger-agent.jar]
Disconnected from the target VM, address: ‘127.0.0.1:10282’, transport: ‘socket’
[2020-06-16 23:31:37.830] [main] [ERROR] org.springframework.boot.SpringApplication - Application run failed
org.springframework.beans.factory.BeanDefinitionStoreException: Invalid bean definition with name ‘inputMess’ defined in com.ali.service.StreamClient: bean definition with this name already exists - Root bean: class [null]; scope=; abstract=false; lazyInit=false; autowireMode=0; dependencyCheck=0; autowireCandidate=true; primary=false; factoryBeanName=com.ali.service.StreamClient; factoryMethodName=input; initMethodName=null; destroyMethodName=null

写回答

2回答

廖师兄

2020-06-18

不同版本的stream组件变化很大。
新版要求input和output名字要不一样。
你先用旧版,保持和课程里一样的版本。以后统一升级到新版。

1
2
廖师兄
回复
ly_simon
生产两次、消费端只能接到一次 ~ 是不是有什么配置. 不需要额外配置。你看看是不是启动了多个消费端。
2020-06-28
共2条回复

廖师兄

2020-06-18

你是不是在qq群里问我的那个同学?你在群里里说是你自己写错了

0
2
廖师兄
回复
ly_simon
把错误日志格式化,网页上富文本编辑里选择插入代码
2020-06-18
共2条回复

SpringCloud Finchley(M2+RELEASE+SR2)微服务实战

SpringCloud组件实现微服务,【已升级Finchley.Release】

5668 学习 · 2489 问题

查看课程