java.lang.IllegalStateException: Another endpoint is already registered with id 'myuniquecustomid'

Spring JIRA | Josip Medic | 9 months ago
  1. 0

    If we have following situation: interface: {code:title=ConsumerService.java |borderStyle=solid} public interface ConsumerService<TPayLoad> { void consume(TPayLoad message); } {code} and also following interface implementation: {code:title=TestingQueueConsumerServiceImpl.java |borderStyle=solid} @Component public class TestingQueueConsumerServiceImpl implements ConsumerService<DemoMessage> { private Log log = LogFactory.getLog(getClass()); @Transactional @RabbitListener(queues = "${rabbitmq.queue.demo}", id = "myuniquecustomid") public void consume(@Payload TestMessage message) { Assert.notNull(message); log.info(message.toString()); } } {code} on application start we gets following exception {noformat} 2016-03-24 09:26:48.971 INFO 58632 --- [ main] o.apache.catalina.core.StandardService : Stopping service Tomcat 2016-03-24 09:26:48.982 ERROR 58632 --- [ main] o.s.boot.SpringApplication : Application startup failed java.lang.IllegalStateException: Another endpoint is already registered with id 'myuniquecustomid' at org.springframework.util.Assert.state(Assert.java:392) ~[spring-core-4.2.5.RELEASE.jar:4.2.5.RELEASE] at org.springframework.amqp.rabbit.listener.RabbitListenerEndpointRegistry.registerListenerContainer(RabbitListenerEndpointRegistry.java:146) ~[spring-rabbit-1.5.4.RELEASE.jar:na] at org.springframework.amqp.rabbit.listener.RabbitListenerEndpointRegistry.registerListenerContainer(RabbitListenerEndpointRegistry.java:122) ~[spring-rabbit-1.5.4.RELEASE.jar:na] at org.springframework.amqp.rabbit.listener.RabbitListenerEndpointRegistrar.registerAllEndpoints(RabbitListenerEndpointRegistrar.java:134) ~[spring-rabbit-1.5.4.RELEASE.jar:na] at org.springframework.amqp.rabbit.listener.RabbitListenerEndpointRegistrar.afterPropertiesSet(RabbitListenerEndpointRegistrar.java:128) ~[spring-rabbit-1.5.4.RELEASE.jar:na] at org.springframework.amqp.rabbit.annotation.RabbitListenerAnnotationBeanPostProcessor.afterSingletonsInstantiated(RabbitListenerAnnotationBeanPostProcessor.java:209) ~[spring-rabbit-1.5.4.RELEASE.jar:na] at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:792) ~[spring-beans-4.2.5.RELEASE.jar:4.2.5.RELEASE] at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:839) ~[spring-context-4.2.5.RELEASE.jar:4.2.5.RELEASE] at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:538) ~[spring-context-4.2.5.RELEASE.jar:4.2.5.RELEASE] at org.springframework.boot.context.embedded.EmbeddedWebApplicationContext.refresh(EmbeddedWebApplicationContext.java:118) ~[spring-boot-1.3.3.RELEASE.jar:1.3.3.RELEASE] at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:766) [spring-boot-1.3.3.RELEASE.jar:1.3.3.RELEASE] at org.springframework.boot.SpringApplication.createAndRefreshContext(SpringApplication.java:361) [spring-boot-1.3.3.RELEASE.jar:1.3.3.RELEASE] at org.springframework.boot.SpringApplication.run(SpringApplication.java:307) [spring-boot-1.3.3.RELEASE.jar:1.3.3.RELEASE] at org.springframework.boot.SpringApplication.run(SpringApplication.java:1191) [spring-boot-1.3.3.RELEASE.jar:1.3.3.RELEASE] at org.springframework.boot.SpringApplication.run(SpringApplication.java:1180) [spring-boot-1.3.3.RELEASE.jar:1.3.3.RELEASE] {noformat} This is happening as @RabbitListener annotation creates two listener instances, one for interface method and one for implementing method. After implementation of `ConsumerService<DemoMessage>` is removed then everything is working as expected.

    Spring JIRA | 9 months ago | Josip Medic
    java.lang.IllegalStateException: Another endpoint is already registered with id 'myuniquecustomid'
  2. 0

    If we have following situation: interface: {code:title=ConsumerService.java |borderStyle=solid} public interface ConsumerService<TPayLoad> { void consume(TPayLoad message); } {code} and also following interface implementation: {code:title=TestingQueueConsumerServiceImpl.java |borderStyle=solid} @Component public class TestingQueueConsumerServiceImpl implements ConsumerService<DemoMessage> { private Log log = LogFactory.getLog(getClass()); @Transactional @RabbitListener(queues = "${rabbitmq.queue.demo}", id = "myuniquecustomid") public void consume(@Payload TestMessage message) { Assert.notNull(message); log.info(message.toString()); } } {code} on application start we gets following exception {noformat} 2016-03-24 09:26:48.971 INFO 58632 --- [ main] o.apache.catalina.core.StandardService : Stopping service Tomcat 2016-03-24 09:26:48.982 ERROR 58632 --- [ main] o.s.boot.SpringApplication : Application startup failed java.lang.IllegalStateException: Another endpoint is already registered with id 'myuniquecustomid' at org.springframework.util.Assert.state(Assert.java:392) ~[spring-core-4.2.5.RELEASE.jar:4.2.5.RELEASE] at org.springframework.amqp.rabbit.listener.RabbitListenerEndpointRegistry.registerListenerContainer(RabbitListenerEndpointRegistry.java:146) ~[spring-rabbit-1.5.4.RELEASE.jar:na] at org.springframework.amqp.rabbit.listener.RabbitListenerEndpointRegistry.registerListenerContainer(RabbitListenerEndpointRegistry.java:122) ~[spring-rabbit-1.5.4.RELEASE.jar:na] at org.springframework.amqp.rabbit.listener.RabbitListenerEndpointRegistrar.registerAllEndpoints(RabbitListenerEndpointRegistrar.java:134) ~[spring-rabbit-1.5.4.RELEASE.jar:na] at org.springframework.amqp.rabbit.listener.RabbitListenerEndpointRegistrar.afterPropertiesSet(RabbitListenerEndpointRegistrar.java:128) ~[spring-rabbit-1.5.4.RELEASE.jar:na] at org.springframework.amqp.rabbit.annotation.RabbitListenerAnnotationBeanPostProcessor.afterSingletonsInstantiated(RabbitListenerAnnotationBeanPostProcessor.java:209) ~[spring-rabbit-1.5.4.RELEASE.jar:na] at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:792) ~[spring-beans-4.2.5.RELEASE.jar:4.2.5.RELEASE] at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:839) ~[spring-context-4.2.5.RELEASE.jar:4.2.5.RELEASE] at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:538) ~[spring-context-4.2.5.RELEASE.jar:4.2.5.RELEASE] at org.springframework.boot.context.embedded.EmbeddedWebApplicationContext.refresh(EmbeddedWebApplicationContext.java:118) ~[spring-boot-1.3.3.RELEASE.jar:1.3.3.RELEASE] at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:766) [spring-boot-1.3.3.RELEASE.jar:1.3.3.RELEASE] at org.springframework.boot.SpringApplication.createAndRefreshContext(SpringApplication.java:361) [spring-boot-1.3.3.RELEASE.jar:1.3.3.RELEASE] at org.springframework.boot.SpringApplication.run(SpringApplication.java:307) [spring-boot-1.3.3.RELEASE.jar:1.3.3.RELEASE] at org.springframework.boot.SpringApplication.run(SpringApplication.java:1191) [spring-boot-1.3.3.RELEASE.jar:1.3.3.RELEASE] at org.springframework.boot.SpringApplication.run(SpringApplication.java:1180) [spring-boot-1.3.3.RELEASE.jar:1.3.3.RELEASE] {noformat} This is happening as @RabbitListener annotation creates two listener instances, one for interface method and one for implementing method. After implementation of `ConsumerService<DemoMessage>` is removed then everything is working as expected.

    Spring JIRA | 9 months ago | Josip Medic
    java.lang.IllegalStateException: Another endpoint is already registered with id 'myuniquecustomid'
  3. 0

    Simple WebMvcTest fails with Spring Boot 1.4M3 due to missing SpringBootConfiguration

    GitHub | 7 months ago | jgoldhammer
    java.lang.IllegalStateException: Unable to find a @SpringBootConfiguration, you need to use @ContextConfiguration or @SpringBootTest(classes=...) with your test
  4. Speed up your debug routine!

    Automated exception search integrated into your IDE

  5. 0

    How to use Spring Hatoas ControllerLinkBuilder for a Thymeleaf templated scheduled email

    Stack Overflow | 1 year ago | Romell
    java.lang.IllegalStateException: Could not find current request via RequestContextHolder. Is this being called from a Spring MVC handler?
  6. 0

    jetty 9.3.1 and 9.3.2 can't find resource in /src/main/webapp

    GitHub | 1 year ago | zhanhb
    java.lang.IllegalStateException: Cannot find template location: /WEB-INF/templates (please add some templates or check your Thymeleaf configuration)

  1. tvrmsmith 2 times, last 3 weeks ago
  2. tvrmsmith 4 times, last 2 months ago
  3. schoetty 8 times, last 7 months ago
  4. Александр Пастухов 1 times, last 7 months ago
48 unregistered visitors
Not finding the right solution?
Take a tour to get the most out of Samebug.

Tired of useless tips?

Automated exception search integrated into your IDE

Root Cause Analysis

  1. java.lang.IllegalStateException

    Another endpoint is already registered with id 'myuniquecustomid'

    at org.springframework.util.Assert.state()
  2. Spring Core
    Assert.state
    1. org.springframework.util.Assert.state(Assert.java:392)[spring-core-4.2.5.RELEASE.jar:4.2.5.RELEASE]
    1 frame
  3. Spring RabbitMQ Support
    RabbitListenerAnnotationBeanPostProcessor.afterSingletonsInstantiated
    1. org.springframework.amqp.rabbit.listener.RabbitListenerEndpointRegistry.registerListenerContainer(RabbitListenerEndpointRegistry.java:146)[spring-rabbit-1.5.4.RELEASE.jar:na]
    2. org.springframework.amqp.rabbit.listener.RabbitListenerEndpointRegistry.registerListenerContainer(RabbitListenerEndpointRegistry.java:122)[spring-rabbit-1.5.4.RELEASE.jar:na]
    3. org.springframework.amqp.rabbit.listener.RabbitListenerEndpointRegistrar.registerAllEndpoints(RabbitListenerEndpointRegistrar.java:134)[spring-rabbit-1.5.4.RELEASE.jar:na]
    4. org.springframework.amqp.rabbit.listener.RabbitListenerEndpointRegistrar.afterPropertiesSet(RabbitListenerEndpointRegistrar.java:128)[spring-rabbit-1.5.4.RELEASE.jar:na]
    5. org.springframework.amqp.rabbit.annotation.RabbitListenerAnnotationBeanPostProcessor.afterSingletonsInstantiated(RabbitListenerAnnotationBeanPostProcessor.java:209)[spring-rabbit-1.5.4.RELEASE.jar:na]
    5 frames
  4. Spring Beans
    DefaultListableBeanFactory.preInstantiateSingletons
    1. org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:792)[spring-beans-4.2.5.RELEASE.jar:4.2.5.RELEASE]
    1 frame
  5. Spring Context
    AbstractApplicationContext.refresh
    1. org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:839)[spring-context-4.2.5.RELEASE.jar:4.2.5.RELEASE]
    2. org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:538)[spring-context-4.2.5.RELEASE.jar:4.2.5.RELEASE]
    2 frames
  6. Spring Boot
    SpringApplication.run
    1. org.springframework.boot.context.embedded.EmbeddedWebApplicationContext.refresh(EmbeddedWebApplicationContext.java:118)[spring-boot-1.3.3.RELEASE.jar:1.3.3.RELEASE]
    2. org.springframework.boot.SpringApplication.refresh(SpringApplication.java:766)[spring-boot-1.3.3.RELEASE.jar:1.3.3.RELEASE]
    3. org.springframework.boot.SpringApplication.createAndRefreshContext(SpringApplication.java:361)[spring-boot-1.3.3.RELEASE.jar:1.3.3.RELEASE]
    4. org.springframework.boot.SpringApplication.run(SpringApplication.java:307)[spring-boot-1.3.3.RELEASE.jar:1.3.3.RELEASE]
    5. org.springframework.boot.SpringApplication.run(SpringApplication.java:1191)[spring-boot-1.3.3.RELEASE.jar:1.3.3.RELEASE]
    6. org.springframework.boot.SpringApplication.run(SpringApplication.java:1180)[spring-boot-1.3.3.RELEASE.jar:1.3.3.RELEASE]
    6 frames