java.lang.IllegalStateException: Cannot register resolved alias 'my.shared.name' (original: '${exchange.foo.name}') for name 'exchangeFoo: It is already registered for name 'exchangeFoo'.

Spring JIRA | Peter Moore | 6 months ago
  1. 0

    I've got the following Queue and Exchange declarations: {code} <rabbit:queue id="queueFoo" name="${queue.foo.name}" durable="true" exclusive="false"/> <rabbit:direct-exchange id="exchangeFoo" name="${exchange.foo.name}" durable="true"> <rabbit:bindings> <rabbit:binding queue="queueFoo" key="${queue.foo.name}"/> </rabbit:bindings> </rabbit:direct-exchange> {code} Importantly, my exchange and queue names happen to be the same in this case. config.props: {code} queue.foo.name=my.shared.name exchange.foo.name=my.shared.name {code} On context initialization, I get this exception: {code} 20160610 11:39:20.991 [ERROR] (main) o.s.web.context.ContextLoader Context initialization failed java.lang.IllegalStateException: Cannot register resolved alias 'my.shared.name' (original: '${exchange.foo.name}') for name 'exchangeFoo: It is already registered for name 'exchangeFoo'. at org.springframework.core.SimpleAliasRegistry.resolveAliases(SimpleAliasRegistry.java:157) ~[spring-core-4.2.3.RELEASE.jar:4.2.3.RELEASE] {code} The error message there is a bit confusing, but I debugged into SimpleAliasRegistry, and basically, Spring's alias logic has detected that the "name" aliases are the same for both the exchange and queue beans. This makes sense, given the normal Spring semantics for the bean 'name' attribute as an alias for 'id'. If I take property placeholders out of the picture, and just use the same name ("my.shared.name") for the queue and the exchange beans, things work fine, so the bug is probably a bean post-processing issue. I can work around this for now, by choosing different names for the exchange and the queue. However, my bigger worry (and the reason I've marked this as major) is that if someone from my Ops team were to change a queue name in the application's configuration, that could potentially clash with one of the app's Spring bean names / aliases, causing a very confusing failure. It seems like it would be better to fully separate the queue/exchange naming from Spring's default 'name' functionality, and choose an entirely different attribute, such as 'queueName'.

    Spring JIRA | 6 months ago | Peter Moore
    java.lang.IllegalStateException: Cannot register resolved alias 'my.shared.name' (original: '${exchange.foo.name}') for name 'exchangeFoo: It is already registered for name 'exchangeFoo'.
  2. 0

    I've got the following Queue and Exchange declarations: {code} <rabbit:queue id="queueFoo" name="${queue.foo.name}" durable="true" exclusive="false"/> <rabbit:direct-exchange id="exchangeFoo" name="${exchange.foo.name}" durable="true"> <rabbit:bindings> <rabbit:binding queue="queueFoo" key="${queue.foo.name}"/> </rabbit:bindings> </rabbit:direct-exchange> {code} Importantly, my exchange and queue names happen to be the same in this case. config.props: {code} queue.foo.name=my.shared.name exchange.foo.name=my.shared.name {code} On context initialization, I get this exception: {code} 20160610 11:39:20.991 [ERROR] (main) o.s.web.context.ContextLoader Context initialization failed java.lang.IllegalStateException: Cannot register resolved alias 'my.shared.name' (original: '${exchange.foo.name}') for name 'exchangeFoo: It is already registered for name 'exchangeFoo'. at org.springframework.core.SimpleAliasRegistry.resolveAliases(SimpleAliasRegistry.java:157) ~[spring-core-4.2.3.RELEASE.jar:4.2.3.RELEASE] {code} The error message there is a bit confusing, but I debugged into SimpleAliasRegistry, and basically, Spring's alias logic has detected that the "name" aliases are the same for both the exchange and queue beans. This makes sense, given the normal Spring semantics for the bean 'name' attribute as an alias for 'id'. If I take property placeholders out of the picture, and just use the same name ("my.shared.name") for the queue and the exchange beans, things work fine, so the bug is probably a bean post-processing issue. I can work around this for now, by choosing different names for the exchange and the queue. However, my bigger worry (and the reason I've marked this as major) is that if someone from my Ops team were to change a queue name in the application's configuration, that could potentially clash with one of the app's Spring bean names / aliases, causing a very confusing failure. It seems like it would be better to fully separate the queue/exchange naming from Spring's default 'name' functionality, and choose an entirely different attribute, such as 'queueName'.

    Spring JIRA | 6 months ago | Peter Moore
    java.lang.IllegalStateException: Cannot register resolved alias 'my.shared.name' (original: '${exchange.foo.name}') for name 'exchangeFoo: It is already registered for name 'exchangeFoo'.
  3. 0

    Spring Boot war fails to deploy properly on Resin server

    Stack Overflow | 3 years ago | Chris
    java.lang.IllegalStateException: Registration is null. Was something already registered for name=[errorPageFilter]?
  4. Speed up your debug routine!

    Automated exception search integrated into your IDE

  5. 0

    Spring Boot war fails to deploy properly on Resin server

    Stack Overflow | 3 years ago | Chris
    java.lang.IllegalStateException: Registration is null. Was something already registered for name=[errorPageFilter]?
  6. 0

    IllegalStateException: Registration is null when migrating RC3 -> RC4

    GitHub | 3 years ago | tkruse
    java.util.concurrent.ExecutionException: org.apache.catalina.LifecycleException: Failed to start component [StandardEngine[Tomcat].StandardHost[localhost].StandardContext[]]

    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

      Cannot register resolved alias 'my.shared.name' (original: '${exchange.foo.name}') for name 'exchangeFoo: It is already registered for name 'exchangeFoo'.

      at org.springframework.core.SimpleAliasRegistry.resolveAliases()
    2. Spring Core
      SimpleAliasRegistry.resolveAliases
      1. org.springframework.core.SimpleAliasRegistry.resolveAliases(SimpleAliasRegistry.java:157)[spring-core-4.2.3.RELEASE.jar:4.2.3.RELEASE]
      1 frame