Uploaded image for project: 'Red Hat Fuse'
  1. Red Hat Fuse
  2. ENTESB-10901

Spring Contexts With External Property Placeholders Fail to Properly Initialize with "Invalid bean definition"

    XMLWordPrintable

Details

    • Bug
    • Resolution: Not a Bug
    • Major
    • None
    • jboss-fuse-6.3, fuse-6.x-GA
    • Fabric8 v1, Karaf
    • None
    • % %
    • -
    • Hide

      Example profiles attached:

      • Extract the attached mq.zip profile archive and edit the profiles as needed to update host / IP information
      • Zip the corrected profiles
      • Configure a 3-node fabric cluster (it may reproduce on a single node cluster, but I didn't get a change to test that)
      • Import the mq.zip profile archive
      • Create 3 child broker containers and assign the mq/broker/default.sync1-3 to the containers.
      • Restart the containers (it may take several times_ until the above error is noted in the logs
      • The broker fails to start due to the missing placeholder
      • After removing and replacing the profile, container often (not always) resolves and provisions correctly.

      Example flow:

      > fabric:create --wait-for-provisioning --bind-address node1.redhat.com --resolver manualip --manual-ip node1.redhat.com
      > profile-import file:///path/to/mq.zip
      > container-create-ssh --host node2.redhat.com --bind-address node2.redhat.com --resolver manualip  --manual-ip node2.redhat.com --private-key /home/{user}/.ssh/id_rsa --path /home/{user}/fuse/containers --profile jboss-fuse-full node2
      > container-create-ssh --host node3.redhat.com --bind-address node3.redhat.com --resolver manualip  --manual-ip node3.redhat.com --private-key /home/{user}/.ssh/id_rsa --path /home/{user}/fuse/containers --profile jboss-fuse-full node3
      > ensemble-add node2 node3
      > container-create-child --profile mq-broker-default.sync1 node1 broker1
      > container-create-child --profile mq-broker-default.sync2 node2 broker2
      > container-create-child --profile mq-broker-default.sync3 node3 broker3
      > container-stop broker1
      > container-start broker1
      
      Show
      Example profiles attached: Extract the attached mq.zip profile archive and edit the profiles as needed to update host / IP information Zip the corrected profiles Configure a 3-node fabric cluster (it may reproduce on a single node cluster, but I didn't get a change to test that) Import the mq.zip profile archive Create 3 child broker containers and assign the mq/broker/default.sync1-3 to the containers. Restart the containers (it may take several times_ until the above error is noted in the logs The broker fails to start due to the missing placeholder After removing and replacing the profile, container often (not always) resolves and provisions correctly. Example flow: > fabric:create --wait- for -provisioning --bind-address node1.redhat.com --resolver manualip --manual-ip node1.redhat.com > profile- import file: ///path/to/mq.zip > container-create-ssh --host node2.redhat.com --bind-address node2.redhat.com --resolver manualip --manual-ip node2.redhat.com -- private -key /home/{user}/.ssh/id_rsa --path /home/{user}/fuse/containers --profile jboss-fuse-full node2 > container-create-ssh --host node3.redhat.com --bind-address node3.redhat.com --resolver manualip --manual-ip node3.redhat.com -- private -key /home/{user}/.ssh/id_rsa --path /home/{user}/fuse/containers --profile jboss-fuse-full node3 > ensemble-add node2 node3 > container-create-child --profile mq-broker- default .sync1 node1 broker1 > container-create-child --profile mq-broker- default .sync2 node2 broker2 > container-create-child --profile mq-broker- default .sync3 node3 broker3 > container-stop broker1 > container-start broker1

    Description

      When restarting fabric (v1) containers with profiles containing spring contexts with externalized properties, the context often fails to initialize with a failure to resolve a property placeholder. It often takes several restarts or removal and replacement of the same profile for the container to correctly initialize.

      2019-06-22 15:46:52,929 | ERROR | AMQ-1-thread-1   | ActiveMQServiceFactory           | 221 - io.fabric8.mq.mq-fabric - 1.2.0.redhat-630377 | Exception on start: org.springframework.beans.factory.BeanDefinitionStoreException: Invalid bean definition with name 'org.apache.activemq.xbean.XBeanBrokerService#0' defined in URL [profile:sync-broker.xml]: Could not resolve placeholder 'broker.network.connector.1.name' in string value "${broker.network.connector.1.name}"; nested exception is java.lang.IllegalArgumentException: Could not resolve placeholder 'broker.network.connector.1.name' in string value "${broker.network.connector.1.name}"
      org.springframework.beans.factory.BeanDefinitionStoreException: Invalid bean definition with name 'org.apache.activemq.xbean.XBeanBrokerService#0' defined in URL [profile:sync-broker.xml]: Could not resolve placeholder 'broker.network.connector.1.name' in string value "${broker.network.connector.1.name}"; nested exception is java.lang.IllegalArgumentException: Could not resolve placeholder 'broker.network.connector.1.name' in string value "${broker.network.connector.1.name}"
      	at org.springframework.beans.factory.config.PlaceholderConfigurerSupport.doProcessProperties(PlaceholderConfigurerSupport.java:209)[236:org.apache.servicemix.bundles.spring-beans:3.2.18.RELEASE_1]
      	at org.springframework.beans.factory.config.PropertyPlaceholderConfigurer.processProperties(PropertyPlaceholderConfigurer.java:222)[236:org.apache.servicemix.bundles.spring-beans:3.2.18.RELEASE_1]
      	at org.springframework.beans.factory.config.PropertyResourceConfigurer.postProcessBeanFactory(PropertyResourceConfigurer.java:84)[236:org.apache.servicemix.bundles.spring-beans:3.2.18.RELEASE_1]
      	at org.springframework.context.support.AbstractApplicationContext.invokeBeanFactoryPostProcessors(AbstractApplicationContext.java:703)[237:org.apache.servicemix.bundles.spring-context:3.2.18.RELEASE_1]
      	at org.springframework.context.support.AbstractApplicationContext.invokeBeanFactoryPostProcessors(AbstractApplicationContext.java:678)[237:org.apache.servicemix.bundles.spring-context:3.2.18.RELEASE_1]
      	at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:464)[237:org.apache.servicemix.bundles.spring-context:3.2.18.RELEASE_1]
      	at org.apache.xbean.spring.context.ResourceXmlApplicationContext.<init>(ResourceXmlApplicationContext.java:64)[245:org.apache.xbean.spring:3.18.0]
      	at org.apache.xbean.spring.context.ResourceXmlApplicationContext.<init>(ResourceXmlApplicationContext.java:52)[245:org.apache.xbean.spring:3.18.0]
      	at io.fabric8.mq.fabric.ActiveMQServiceFactory$1.<init>(ActiveMQServiceFactory.java:164)[221:io.fabric8.mq.mq-fabric:1.2.0.redhat-630377]
      	at io.fabric8.mq.fabric.ActiveMQServiceFactory.createBroker(ActiveMQServiceFactory.java:164)[221:io.fabric8.mq.mq-fabric:1.2.0.redhat-630377]
      	at io.fabric8.mq.fabric.ActiveMQServiceFactory$ClusteredConfiguration.doStart(ActiveMQServiceFactory.java:544)[221:io.fabric8.mq.mq-fabric:1.2.0.redhat-630377]
      	at io.fabric8.mq.fabric.ActiveMQServiceFactory$ClusteredConfiguration.access$600(ActiveMQServiceFactory.java:359)[221:io.fabric8.mq.mq-fabric:1.2.0.redhat-630377]
      	at io.fabric8.mq.fabric.ActiveMQServiceFactory$ClusteredConfiguration$1.run(ActiveMQServiceFactory.java:499)[221:io.fabric8.mq.mq-fabric:1.2.0.redhat-630377]
      	at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)[:1.8.0_201]
      	at java.util.concurrent.FutureTask.run(FutureTask.java:266)[:1.8.0_201]
      	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)[:1.8.0_201]
      	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)[:1.8.0_201]
      	at java.lang.Thread.run(Thread.java:748)[:1.8.0_201]
      Caused by: java.lang.IllegalArgumentException: Could not resolve placeholder 'broker.network.connector.1.name' in string value "${broker.network.connector.1.name}"
      	at org.springframework.util.PropertyPlaceholderHelper.parseStringValue(PropertyPlaceholderHelper.java:173)[239:org.apache.servicemix.bundles.spring-core:3.2.18.RELEASE_1]
      	at org.springframework.util.PropertyPlaceholderHelper.replacePlaceholders(PropertyPlaceholderHelper.java:125)[239:org.apache.servicemix.bundles.spring-core:3.2.18.RELEASE_1]
      	at org.springframework.beans.factory.config.PropertyPlaceholderConfigurer$PlaceholderResolvingStringValueResolver.resolveStringValue(PropertyPlaceholderConfigurer.java:257)[236:org.apache.servicemix.bundles.spring-beans:3.2.18.RELEASE_1]
      	at org.springframework.beans.factory.config.BeanDefinitionVisitor.resolveStringValue(BeanDefinitionVisitor.java:282)[236:org.apache.servicemix.bundles.spring-beans:3.2.18.RELEASE_1]
      	at org.springframework.beans.factory.config.BeanDefinitionVisitor.resolveValue(BeanDefinitionVisitor.java:209)[236:org.apache.servicemix.bundles.spring-beans:3.2.18.RELEASE_1]
      	at org.springframework.beans.factory.config.BeanDefinitionVisitor.visitPropertyValues(BeanDefinitionVisitor.java:141)[236:org.apache.servicemix.bundles.spring-beans:3.2.18.RELEASE_1]
      	at org.springframework.beans.factory.config.BeanDefinitionVisitor.visitBeanDefinition(BeanDefinitionVisitor.java:82)[236:org.apache.servicemix.bundles.spring-beans:3.2.18.RELEASE_1]
      	at org.springframework.beans.factory.config.BeanDefinitionVisitor.resolveValue(BeanDefinitionVisitor.java:172)[236:org.apache.servicemix.bundles.spring-beans:3.2.18.RELEASE_1]
      	at org.springframework.beans.factory.config.BeanDefinitionVisitor.visitList(BeanDefinitionVisitor.java:228)[236:org.apache.servicemix.bundles.spring-beans:3.2.18.RELEASE_1]
      	at org.springframework.beans.factory.config.BeanDefinitionVisitor.resolveValue(BeanDefinitionVisitor.java:192)[236:org.apache.servicemix.bundles.spring-beans:3.2.18.RELEASE_1]
      	at org.springframework.beans.factory.config.BeanDefinitionVisitor.visitPropertyValues(BeanDefinitionVisitor.java:141)[236:org.apache.servicemix.bundles.spring-beans:3.2.18.RELEASE_1]
      	at org.springframework.beans.factory.config.BeanDefinitionVisitor.visitBeanDefinition(BeanDefinitionVisitor.java:82)[236:org.apache.servicemix.bundles.spring-beans:3.2.18.RELEASE_1]
      	at org.springframework.beans.factory.config.PlaceholderConfigurerSupport.doProcessProperties(PlaceholderConfigurerSupport.java:206)[236:org.apache.servicemix.bundles.spring-beans:3.2.18.RELEASE_1]
      	... 17 more
      

      This reproduces with a fairly common use case of mq profiles with an inheritance hierarchy where the assigned profiles derive from a common parent containing the broker XML configuration. After assigning these profiles to containers the containers intermittently fail to initialize on restart and may take several attempts to start correctly, or may only initialize correctly after removing the mq profile and reinstalling it.

      Attachments

        Activity

          People

            ggrzybek Grzegorz Grzybek
            rhn-support-dhawkins Duane Hawkins
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: