Spring Boot, SpringCloud, SpringCloud Alibaba project integrates RocketMQ. As soon as you start, you report an error:
Correct the classpath of your application so that it contains a single, compatible version of org.springframework.integration.channel.AbstractMessageChannel
Project POM dependency uses:
<!--RocketMQ -->
<dependency>
<groupId>com.alibaba.cloud</groupId>
<artifactId>spring-cloud-starter-stream-rocketmq</artifactId>
</dependency>
version is: 5.3.0.release
One starting project will report an error:
Description:
An attempt was made to call a method that does not exist. The attempt was made from the following location:
com.alibaba.cloud.stream.binder.rocketmq.RocketMQMessageChannelBinder.createProducerMessageHandler(RocketMQMessageChannelBinder.java:172)
The following method did not exist:
org.springframework.integration.channel.AbstractMessageChannel.getChannelInterceptors()Ljava/util/List;
The method's class, org.springframework.integration.channel.AbstractMessageChannel, is available from the following locations:
jar:file:/D:/zoutao_job/maven_repository/org/springframework/integration/spring-integration-core/5.3.0.RELEASE/spring-integration-core-5.3.0.RELEASE.jar!/org/springframework/integration/channel/AbstractMessageChannel.class
It was loaded from the following location:
file:/D:/zoutao_job/maven_repository/org/springframework/integration/spring-integration-core/5.3.0.RELEASE/spring-integration-core-5.3.0.RELEASE.jar
Action:
Correct the classpath of your application so that it contains a single, compatible version of org.springframework.integration.channel.AbstractMessageChannel
icon:
from the error message, it is known that it isspring-integration-core-5.3.0.RELEASE.jarproblem
Point in the source code, check the AbstractMessageChannel class and find that there is no GetChannelInterceptors method, and line at rocketMQMessageChannelBinder.java:172, an error occurs:
official website for a long time:
https://github.com/alibaba/spring-cloud-alibaba/pull/1503
probably means that the Spring-Integration-Core version comes with Spring-Cloud-Starter-Stream-Rocketmq is too high to revise and not applicable.
Because a Spring-Integration-core version is too easy to change the MQ version, it is too easy to make an error, so it is not adopted. In the previous version, the Spring-Integration-core version is 5.2.1, so we eliminate the packaging high version and change to a custom version.
Change the pom as follows:
<!--RocketMQ -->
<dependency>
<groupId>com.alibaba.cloud</groupId>
<artifactId>spring-cloud-starter-stream-rocketmq</artifactId>
<exclusions>
<exclusion>
<groupId>org.springframework.integration</groupId>
<artifactId>spring-integration-core</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>org.springframework.integration</groupId>
<artifactId>spring-integration-core</artifactId>
<version>5.2.1.RELEASE</version>
</dependency>
Excluding the original version of the original 5.3.0 or above, and the version 5.2.1 is used.
Starting project is normal:
View RocketMQMESSAGECHANLBINDER 172 lines are no longer popular.