Quantcast

FatalListenerStartupException: Mismatched queues

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

FatalListenerStartupException: Mismatched queues

dimuthu
This post has NOT been accepted by the mailing list yet.
Hi All,
Im new to Spring boot and RabbitMQ. Im working on an application to produce json object and consume it. I have been getting this error when my spring boot module starts up:
org.springframework.amqp.rabbit.listener.exception.FatalListenerStartupException: Mismatched queues
        at org.springframework.amqp.rabbit.listener.SimpleMessageListenerContainer.redeclareElementsIfNecessary(SimpleMessageListenerContainer.java:1114) ~[spring-rabbit-1.6.2.RELEASE.jar:na]
        at org.springframework.amqp.rabbit.listener.SimpleMessageListenerContainer.access$700(SimpleMessageListenerContainer.java:95) ~[spring-rabbit-1.6.2.RELEASE.jar:na]
        at org.springframework.amqp.rabbit.listener.SimpleMessageListenerContainer$AsyncMessageProcessingConsumer.run(SimpleMessageListenerContainer.java:1278) ~[spring-rabbit-1.6.2.RELEASE.jar:na]
        at java.lang.Thread.run(Thread.java:745) [na:1.7.0_79]
Caused by: org.springframework.amqp.AmqpIOException: java.io.IOException
        at org.springframework.amqp.rabbit.support.RabbitExceptionTranslator.convertRabbitAccessException(RabbitExceptionTranslator.java:71) ~[spring-rabbit-1.6.2.RELEASE.jar:na]
        at org.springframework.amqp.rabbit.connection.RabbitAccessor.convertRabbitAccessException(RabbitAccessor.java:113) ~[spring-rabbit-1.6.2.RELEASE.jar:na]
        at org.springframework.amqp.rabbit.core.RabbitTemplate.doExecute(RabbitTemplate.java:1418) ~[spring-rabbit-1.6.2.RELEASE.jar:na]
        at org.springframework.amqp.rabbit.core.RabbitTemplate.execute(RabbitTemplate.java:1368) ~[spring-rabbit-1.6.2.RELEASE.jar:na]
        at org.springframework.amqp.rabbit.core.RabbitTemplate.execute(RabbitTemplate.java:1344) ~[spring-rabbit-1.6.2.RELEASE.jar:na]
        at org.springframework.amqp.rabbit.core.RabbitAdmin.initialize(RabbitAdmin.java:502) ~[spring-rabbit-1.6.2.RELEASE.jar:na]
        at org.springframework.amqp.rabbit.core.RabbitAdmin$11.onCreate(RabbitAdmin.java:418) ~[spring-rabbit-1.6.2.RELEASE.jar:na]
        at org.springframework.amqp.rabbit.connection.CompositeConnectionListener.onCreate(CompositeConnectionListener.java:33) ~[spring-rabbit-1.6.2.RELEASE.jar:na]
        at org.springframework.amqp.rabbit.connection.CachingConnectionFactory.createConnection(CachingConnectionFactory.java:553) ~[spring-rabbit-1.6.2.RELEASE.jar:na]
        at org.springframework.amqp.rabbit.core.RabbitTemplate.doExecute(RabbitTemplate.java:1387) ~[spring-rabbit-1.6.2.RELEASE.jar:na]
        at org.springframework.amqp.rabbit.core.RabbitTemplate.execute(RabbitTemplate.java:1368) ~[spring-rabbit-1.6.2.RELEASE.jar:na]
        at org.springframework.amqp.rabbit.core.RabbitTemplate.execute(RabbitTemplate.java:1344) ~[spring-rabbit-1.6.2.RELEASE.jar:na]
        at org.springframework.amqp.rabbit.core.RabbitAdmin.getQueueProperties(RabbitAdmin.java:335) ~[spring-rabbit-1.6.2.RELEASE.jar:na]
        at org.springframework.amqp.rabbit.listener.SimpleMessageListenerContainer.redeclareElementsIfNecessary(SimpleMessageListenerContainer.java:1102) ~[spring-rabbit-1.6.2.RELEASE.jar:na]
        ... 3 common frames omitted
Caused by: java.io.IOException: null
        at com.rabbitmq.client.impl.AMQChannel.wrap(AMQChannel.java:106) ~[amqp-client-3.6.3.jar:na]
        at com.rabbitmq.client.impl.AMQChannel.wrap(AMQChannel.java:102) ~[amqp-client-3.6.3.jar:na]
        at com.rabbitmq.client.impl.AMQChannel.exnWrappingRpc(AMQChannel.java:124) ~[amqp-client-3.6.3.jar:na]
        at com.rabbitmq.client.impl.ChannelN.queueDeclare(ChannelN.java:844) ~[amqp-client-3.6.3.jar:na]
        at com.rabbitmq.client.impl.ChannelN.queueDeclare(ChannelN.java:61) ~[amqp-client-3.6.3.jar:na]
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[na:1.7.0_79]
        at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57) ~[na:1.7.0_79]
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[na:1.7.0_79]
        at java.lang.reflect.Method.invoke(Method.java:606) ~[na:1.7.0_79]
        at org.springframework.amqp.rabbit.connection.CachingConnectionFactory$CachedChannelInvocationHandler.invoke(CachingConnectionFactory.java:917) ~[spring-rabbit-1.6.2.RELEASE.jar:na]
        at com.sun.proxy.$Proxy57.queueDeclare(Unknown Source) ~[na:na]
        at org.springframework.amqp.rabbit.core.RabbitAdmin.declareQueues(RabbitAdmin.java:577) ~[spring-rabbit-1.6.2.RELEASE.jar:na]
        at org.springframework.amqp.rabbit.core.RabbitAdmin.access$200(RabbitAdmin.java:67) ~[spring-rabbit-1.6.2.RELEASE.jar:na]
        at org.springframework.amqp.rabbit.core.RabbitAdmin$12.doInRabbit(RabbitAdmin.java:506) ~[spring-rabbit-1.6.2.RELEASE.jar:na]
        at org.springframework.amqp.rabbit.core.RabbitTemplate.doExecute(RabbitTemplate.java:1412) ~[spring-rabbit-1.6.2.RELEASE.jar:na]
        ... 14 common frames omitted
Caused by: com.rabbitmq.client.ShutdownSignalException: channel error; protocol method: #method<channel.close>(reply-code=406, reply-text=PRECONDITION_FAILED - inequivalent arg 'x-ha-policy'for queue 'dbs_bulk_message_queue_dimuthu' in vhost '/': received none but current is the value 'all' of type 'longstr', class-id=50, method-id=10)
        at com.rabbitmq.utility.ValueOrException.getValue(ValueOrException.java:67) ~[amqp-client-3.6.3.jar:na]
        at com.rabbitmq.utility.BlockingValueOrException.uninterruptibleGetValue(BlockingValueOrException.java:33) ~[amqp-client-3.6.3.jar:na]
        at com.rabbitmq.client.impl.AMQChannel$BlockingRpcContinuation.getReply(AMQChannel.java:361) ~[amqp-client-3.6.3.jar:na]
        at com.rabbitmq.client.impl.AMQChannel.privateRpc(AMQChannel.java:226) ~[amqp-client-3.6.3.jar:na]
        at com.rabbitmq.client.impl.AMQChannel.exnWrappingRpc(AMQChannel.java:118) ~[amqp-client-3.6.3.jar:na]
        ... 26 common frames omitted


Following are my source files :

<?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 http://maven.apache.org/xsd/maven-4.0.0.xsd">

        <modelVersion>4.0.0</modelVersion>
        <groupId>SpringBootRasbbitMQ</groupId>
        <artifactId>spring-boot-sample-amqp</artifactId>
        <packaging>war</packaging>
        <version>0.0.1-SNAPSHOT</version>
        <name>spring-boot-sample-amqp Maven Webapp</name>
        <url>http://maven.apache.org</url>
        <parent>
                <groupId>org.springframework.boot</groupId>
                <artifactId>spring-boot-starter-parent</artifactId>
                <version>1.4.1.RELEASE</version>
        </parent>

        <dependencies>
                <dependency>
                        <groupId>org.springframework.boot</groupId>
                        <artifactId>spring-boot-starter-amqp</artifactId>
                </dependency>
                <dependency>
                        <groupId>org.springframework.boot</groupId>
                        <artifactId>spring-boot-starter-test</artifactId>
                        <scope>test</scope>
                </dependency>
                <dependency>
                        <groupId>org.codehaus.jackson</groupId>
                        <artifactId>jackson-mapper-asl</artifactId>
                        <version>1.9.13</version>
                </dependency>
        </dependencies>
        <build>
                <plugins>
                        <plugin>
                                <groupId>org.springframework.boot</groupId>
                                <artifactId>spring-boot-maven-plugin</artifactId>
                        </plugin>
                </plugins>
        </build>
</project>

@SpringBootApplication
@RabbitListener(queues = "queueName")
@EnableScheduling
public class SampleAmqpSimpleApplication {
       
        @Bean
        public Sender mySender() {
                return new Sender();
        }

        @Bean
        public Queue fooQueue() {
                return new Queue("queueName");
        }

/* @Bean
    public RabbitTemplate rabbitTemplate() {
                RabbitTemplate rabbitTemplate =  new RabbitTemplate(connectionFactory());
                rabbitTemplate.setMessageConverter(new JsonMessageConverter());
                return rabbitTemplate;
    }*/
       
          @Bean
            public RabbitTemplate rabbitTemplate() {
                RabbitTemplate rabbitTemplate=new RabbitTemplate(connectionFactory());
                rabbitTemplate.setRoutingKey("eventsQueue");
                rabbitTemplate.setQueue("eventsQueue");
                return rabbitTemplate;
            }
       
        @Bean
        public ConnectionFactory connectionFactory() {
                CachingConnectionFactory connectionFactory = new CachingConnectionFactory("20.11.111.70");
                connectionFactory.setUsername("username");
                connectionFactory.setPassword("password");
                connectionFactory.setRequestedHeartBeat(10);
               
               
                return connectionFactory;
        }
       
        @Bean
        public SimpleMessageListenerContainer serviceListenerContainer() {
            SimpleMessageListenerContainer container = new SimpleMessageListenerContainer();
            container.setConnectionFactory(connectionFactory());
            container.setQueues(fooQueue());
            container.setMessageConverter(new JsonMessageConverter());
            return container;
        }
       
        @RabbitHandler
        public void process(@Payload String foo) {
                System.out.println(new Date() + ": " + foo);
        }

        public static void main(String[] args) throws Exception {
                SpringApplication.run(SampleAmqpSimpleApplication.class, args);
        }
}

public class Sender {
        @Autowired
        private RabbitTemplate rabbitTemplate;

        @Scheduled(fixedDelay = 1000L)
        public void send() {
               
                JSONObject pushPayload = new JSONObject();
                pushPayload.put("type", "Helloooo");
               
                this.rabbitTemplate.convertAndSend("queueName", pushPayload.toString());
        }
}

Can someone please help me to figure our why this error comes when the boot application starts ?
Thank you
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: FatalListenerStartupException: Mismatched queues

normanwang
This post has NOT been accepted by the mailing list yet.
It says "inequivalent arg 'x-ha-policy'for queue 'dbs_bulk_message_queue_dimuthu' in vhost '/': received none but current is the value 'all' of type 'longstr'". My suggestion is delete the queue 'dbs_bulk_message_queue_dimuthu' with cmd 'rabbitmqadmin delete queue name=dbs_bulk_message_queue_dimuthu'
Loading...