Home > Blockchain >  Spring integration uncompatibility with Spring boot
Spring integration uncompatibility with Spring boot

Time:06-08

I have this pom.xml:

<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd">
    <modelVersion>4.0.0</modelVersion>

    <parent>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-starter-parent</artifactId>
        <version>2.3.12.RELEASE</version>
    </parent>

    <groupId>com.example</groupId>
    <artifactId>example-app</artifactId>
    <version>0.0.1-SNAPSHOT</version>

    <properties>
        <java.version>1.8</java.version>
        <paho.version>1.2.5</paho.version>
    </properties>

    <dependencies>
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-integration</artifactId>
        </dependency>

        <dependency>
            <groupId>org.springframework.integration</groupId>
            <artifactId>spring-integration-jmx</artifactId>
        </dependency>

        <dependency>
            <groupId>org.springframework.integration</groupId>
            <artifactId>spring-integration-mqtt</artifactId>
        </dependency>

        <dependency>
            <groupId>org.eclipse.paho</groupId>
            <artifactId>org.eclipse.paho.mqttv5.client</artifactId>
            <version>${paho.version}</version>
        </dependency>
    </dependencies>

</project>

I'm getting this error:

Description:

An attempt was made to call a method that does not exist. The attempt was made from the following location:

    org.springframework.integration.config.DefaultConfiguringBeanFactoryPostProcessor.registerErrorChannel(DefaultConfiguringBeanFactoryPostProcessor.java:210)

The following method did not exist:

    'org.springframework.beans.factory.support.BeanDefinitionBuilder org.springframework.beans.factory.support.BeanDefinitionBuilder.rootBeanDefinition(java.lang.Class, java.util.function.Supplier)'

The method's class, org.springframework.beans.factory.support.BeanDefinitionBuilder, is available from the following locations:

    jar:file:/Users/user/.m2/repository/org/springframework/spring-beans/5.2.15.RELEASE/spring-beans-5.2.15.RELEASE.jar!/org/springframework/beans/factory/support/BeanDefinitionBuilder.class

The class hierarchy was loaded from the following locations:

    org.springframework.beans.factory.support.BeanDefinitionBuilder: file:/Users/user/.m2/repository/org/springframework/spring-beans/5.2.15.RELEASE/spring-beans-5.2.15.RELEASE.jar


Action:

Correct the classpath of your application so that it contains a single, compatible version of org.springframework.beans.factory.support.BeanDefinitionBuilder

I really couldn't figure out which combination of versions of spring boot parent and spring boot integration will make this work.

Thanks!

EDITED:

I change pom.xml to use version 2.3.12.RELEASE of spring boot parent and I removed the version tag of spring-integration-mqtt, but I'm still having the same error.

I have the following dependency tree when I execute mvn dependency:tree -Dincludes="org.springframework:spring-beans":

[INFO] --- maven-dependency-plugin:3.1.2:tree (default-cli) @ example-app ---
[INFO] com.example:example-app:jar:0.0.1-SNAPSHOT
[INFO] \- org.springframework.boot:spring-boot-starter-web:jar:2.3.12.RELEASE:compile
[INFO]    \- org.springframework:spring-web:jar:5.2.15.RELEASE:compile
[INFO]       \- org.springframework:spring-beans:jar:5.2.15.RELEASE:compile

CodePudding user response:

The Spring Boot version 2.3.x is out of support for a while: https://spring.io/projects/spring-boot#support.

Consider to choose the latest and rely on dependency management from Spring Boot by itself: don't use explicit versions for those dependencies which can borrow it from Spring Boot.

The org.eclipse.paho.mqttv5.client will not work with that old Spring Integration version anyway. You have to use at least Spring Boot 2.6.8 to pull Spring Integration 5.5.12.

  • Related