Announcement Announcement Module
Collapse
No announcement yet.
spring-amqp and spring-integration version incompatibility Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • spring-amqp and spring-integration version incompatibility

    hi gary:
    using spring-amqp 1.1.1.RELEASE it seems i have to change the version of spring-rabbit to 1.0.0.RELEASE

    <dependency>
    <groupId>org.springframework.amqp</groupId>
    <artifactId>spring-amqp</artifactId>
    <version>1.1.1.RELEASE</version>
    </dependency>
    <dependency>
    <groupId>org.springframework.amqp</groupId>
    <artifactId>spring-rabbit</artifactId>

    <version>1.0.0.RELEASE</version>
    </dependency>

    the problem is this forms the core to a spring-integration webapp for which i need spring-rabbit:1.1.0.RELEASE which has support for dead-letter-exchange.

    even when i upgrade spring-rabbit:1.1.1.RELEASE i get the same error as with 1.1.0.RELEASE of spring-rabbit.

    the error is :
    Caused by: org.springframework.beans.factory.NoSuchBeanDefini tionException: No bean named 'replies' is defined
    at org.springframework.beans.factory.support.DefaultL istableBeanFactory.getBeanDefinition(DefaultListab leBeanFactory.java:527)


    what would you recommend we do?

    thanks and regards,
    -cogitate

  • #2
    I am not sure what you mean by "it seems i have to change the version of spring-rabbit to 1.0.0.RELEASE".

    You should simply use spring-rabbit 1.1.1.RELEASE and it will bring in spring-amqp 1.1.1.RELEASE as a transitive dependency.

    What is "replies".

    Comment


    • #3
      Originally posted by Gary Russell View Post
      I am not sure what you mean by "it seems i have to change the version of spring-rabbit to 1.0.0.RELEASE".

      You should simply use spring-rabbit 1.1.1.RELEASE and it will bring in spring-amqp 1.1.1.RELEASE as a transitive dependency.
      What is "replies".
      sorry, not to explain the situation, this was posted on lists.rabbitmq from an older post.
      http://rabbitmq.1065348.n5.nabble.co...s-td20687.html

      here's the spring-context file :
      <?xml version="1.0" encoding="UTF-8"?>
      <beans xmlns="http://www.springframework.org/schema/beans" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
      xmlns:rabbit="http://www.springframework.org/schema/rabbit"
      xsi:schemaLocation="http://www.springframework.org/schema/rabbit http://www.springframework.org/schem...rabbit-1.1.xsd
      http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.0.xsd">


      <!-- sets up the exchange -->
      <rabbit:connection-factory id="rabbitConnection" />
      <rabbit:admin connection-factory="rabbitConnection" auto-startup="true"/>

      <rabbit:template reply-queue="replies" id="amqpTemplate" connection-factory="rabbitConnection"
      exchange="s2-amqp.direct" routing-key="submitEchoPayload" queue="amqp_echoPayload">
      <rabbit:reply-listener/>
      </rabbit:template>


      </beans>

      so "replies" is the name of reply-queue for template entry. the problem is spring-amqp-1.1.1.RELEASE doesn't work well with spring-integration for dead-letter-exchanges.

      here's the dependency tree for the project:
      [INFO] +- com.rabbitmq:amqp-client:jar:2.8.1:compile
      [INFO] +- com.google.guava:guava:jar:11.0.2:compile
      [INFO] | \- com.google.code.findbugs:jsr305:jar:1.3.9:compile
      [INFO] +- commons-configuration:commons-configuration:jar:RELEASE:compile
      [INFO] | +- commons-lang:commons-lang:jar:2.6:compile
      [INFO] | \- commons-logging:commons-logging:jar:1.1.1:compile
      [INFO] +- commons-io:commons-io:jar:2.0.1:compile
      [INFO] +- org.springframework.amqp:spring-rabbit:jar:1.1.1.RELEASE:compile
      [INFO] | +- org.springframework.amqp:spring-amqp:jar:1.1.1.RELEASE:compile
      [INFO] | | \- org.springframework:spring-core:jar:3.0.5.RELEASE:compile
      [INFO] | | \- org.springframework:spring-asm:jar:3.0.5.RELEASE:compile
      [INFO] | \- org.springframework:spring-tx:jar:3.0.7.RELEASE:compile
      [INFO] | +- aopalliance:aopalliance:jar:1.0:compile
      [INFO] | +- org.springframework:spring-aop:jar:3.0.5.RELEASE:compile
      [INFO] | \- org.springframework:spring-beans:jar:3.0.5.RELEASE:compile
      [INFO] +- commons-pool:commons-pool:jar:1.6:compile
      [INFO] +- log4j:log4j:jar:1.2.14:compile
      [INFO] +- org.slf4j:slf4j-api:jar:1.5.11:compile
      [INFO] +- org.slf4j:slf4j-log4j12:jar:1.5.11:compile
      [INFO] +- org.springframework:spring-context:jar:3.0.5.RELEASE:test (scope not updated to compile)
      [INFO] | \- org.springframework:spring-expression:jar:3.0.5.RELEASE:test
      [INFO] +- org.springframework:spring-oxm:jar:3.1.1.RELEASE:test
      [INFO] +- org.springframework.ws:spring-xml:jar:2.0.2.RELEASE:test
      [INFO] +- junit:junit:jar:4.8.1:test
      [INFO] \- org.jcheck:jcheck:jar:0.1:test

      and the exception stack is :
      Caused by: org.springframework.beans.factory.BeanCreationExce ption: Error creating bean with name 'amqpTemplate': Cannot resolve reference to bean 'replies' while setting bean property 'replyQueue'; nested exception is org.springframework.beans.factory.NoSuchBeanDefini tionException: No bean named 'replies' is defined
      at org.springframework.beans.factory.support.BeanDefi nitionValueResolver.resolveReference(BeanDefinitio nValueResolver.java:328)
      at org.springframework.beans.factory.support.BeanDefi nitionValueResolver.resolveValueIfNecessary(BeanDe finitionValueResolver.java:106)
      at org.springframework.beans.factory.support.Abstract AutowireCapableBeanFactory.applyPropertyValues(Abs tractAutowireCapableBeanFactory.java:1325)
      at org.springframework.beans.factory.support.Abstract AutowireCapableBeanFactory.populateBean(AbstractAu towireCapableBeanFactory.java:1086)
      at org.springframework.beans.factory.support.Abstract AutowireCapableBeanFactory.doCreateBean(AbstractAu towireCapableBeanFactory.java:517)
      at org.springframework.beans.factory.support.Abstract AutowireCapableBeanFactory.createBean(AbstractAuto wireCapableBeanFactory.java:456)
      at org.springframework.beans.factory.support.Abstract BeanFactory$1.getObject(AbstractBeanFactory.java:2 91)
      at org.springframework.beans.factory.support.DefaultS ingletonBeanRegistry.getSingleton(DefaultSingleton BeanRegistry.java:222)
      at org.springframework.beans.factory.support.Abstract BeanFactory.doGetBean(AbstractBeanFactory.java:288 )
      at org.springframework.beans.factory.support.Abstract BeanFactory.getBean(AbstractBeanFactory.java:190)
      at org.springframework.beans.factory.support.BeanDefi nitionValueResolver.resolveReference(BeanDefinitio nValueResolver.java:322)
      ... 21 more
      Caused by: org.springframework.beans.factory.NoSuchBeanDefini tionException: No bean named 'replies' is defined
      at org.springframework.beans.factory.support.DefaultL istableBeanFactory.getBeanDefinition(DefaultListab leBeanFactory.java:527)
      at org.springframework.beans.factory.support.Abstract BeanFactory.getMergedLocalBeanDefinition(AbstractB eanFactory.java:1083)
      at org.springframework.beans.factory.support.Abstract BeanFactory.doGetBean(AbstractBeanFactory.java:274 )
      at org.springframework.beans.factory.support.Abstract BeanFactory.getBean(AbstractBeanFactory.java:190)
      at org.springframework.beans.factory.support.BeanDefi nitionValueResolver.resolveReference(BeanDefinitio nValueResolver.java:322)
      ... 31 more
      [INFO] ------------------------------------------------------------------------

      the same config works with the following pom entry ( using spring-amqp 1.1.0.RELEASE )
      <dependency>
      <groupId>org.springframework.amqp</groupId>
      <artifactId>spring-rabbit</artifactId>
      <version>1.1.1.RELEASE</version>
      </dependency>
      <dependency>
      <groupId>org.springframework.amqp</groupId>
      <artifactId>spring-amqp</artifactId>
      <version>1.1.0.RELEASE</version>
      </dependency>

      Comment


      • #4
        The attribute reply-queue is not a queue name, it needs to be a reference to a queue...

        Code:
        <rabbit:queue name="replies" />

        Comment


        • #5
          Thanks much Gary!
          that clears up a lot of things..however, how come the strange combination of spring-rabbit-1.0.0.RELEASE and spring-amqp-1.1.1.RELEASE works with reply-queues="replies" w/o complaining?
          [w/o going through the code, i had assumed, you take a queue name - totally wrong, but works with the strange combination above]

          FYI (for all else using spring-integration along w/ spring-amqp)
          use spring-integration-amqp 2.2.0.M2 which will pull in spring-rabbit-1.1.1.RELEASE => spring-amqp-1.1.1.RELEASE.

          regards,
          -cogitate

          Comment


          • #6
            Well, I'd need to know what you mean by "works".

            I very much doubt it "works" as you suspect, because there was no support in spring-rabbit-1.0.0.RELEASE for a fixed reply queue on the RabitTemplate; that feature was added in 1.1.0

            Comment


            • #7
              well, it seems to gary.
              the code is really simple :
              src/main/java/com/bear/EchoClient.java :
              //removing imports for brevity..
              public class EchoClient
              {
              private static Logger logger = LoggerFactory.getLogger(EchoClient.class);
              private static final String PAYLOAD = "Hello world";
              public static void main(String[] args) {
              ApplicationContext context = new ClassPathXmlApplicationContext("classpath:rabbitCo nfiguration.xml");
              AmqpTemplate amqpTemplate = (AmqpTemplate)context.getBean("amqpTemplate");
              logger.info("[Sent:"+PAYLOAD+"]");
              String reply = (String)amqpTemplate.convertSendAndReceive(PAYLOAD );
              logger.info("[Received:"+reply+"]");
              System.exit(0);
              }
              }

              src/main/resources/rabbitConfiguration.xml:
              <!-- removed xml prologs and ns includes for brevity -->
              <!-- sets up the exchange -->
              <rabbit:connection-factory id="rabbitConnection" />
              <rabbit:admin connection-factory="rabbitConnection" auto-startup="true"/>

              <rabbit:template reply-queue="replies" id="amqpTemplate" connection-factory="rabbitConnection"
              exchange="s2-amqp.direct" routing-key="submitEchoPayload" queue="amqp_echoPayload">
              <rabbit:reply-listener/>
              </rabbit:template>


              </beans>


              and finally pom.xml :
              ......

              <dependency>
              <groupId>org.springframework.amqp</groupId>
              <artifactId>spring-amqp</artifactId>
              <version>1.1.1.RELEASE</version>
              </dependency>
              <dependency>
              <groupId>org.springframework.amqp</groupId>
              <artifactId>spring-rabbit</artifactId>
              <version>1.0.0.RELEASE</version>
              </dependency>
              .....

              can send you a jar of source if required.

              regards,
              -cogitate

              Comment

              Working...
              X