Search code examples
springspring-bootspring-mvcspring-amqpspring-rabbit

Error creating bean defined in class path resource [rabbit-context.xml] from dependency


I upgraded spring amqp & rabbit version from 1.7 to 2.2.8 Release version. The build deployment fails with this error from a dependent service jar. How can this be resolved.

<dependency>
                <groupId>org.springframework.amqp</groupId>
                <artifactId>spring-amqp</artifactId>
                <version>2.2.8.RELEASE</version>
            </dependency>
                <dependency>
                    <groupId>org.springframework.amqp</groupId>
                    <artifactId>spring-rabbit</artifactId>
                    <version>2.2.8.RELEASE</version>
                </dependency>
Error creating bean with name 'amqpAdmin' defined in class path resource [rabbit-context.xml]: Invocation of init method failed; nested exception is java.lang.NoSuchMethodError: org.springframework.retry.policy.SimpleRetryPolicy.<init>(I)V
        at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1796)
        at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:595)
        at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:517)
        at org.springframework.beans.factory.support.AbstractBeanFactory.lambda$doGetBean$0(AbstractBeanFactory.java:323)
        at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:226)
        at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:321)
        at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:202)```

Solution

  • It looks like you have an old version of spring-retry on the classpath - that constructor was added in 1.1.4.

    You should be using 1.2.5 or 1.3.0.