Uploaded image for project: 'Aries'
  1. Aries
  2. ARIES-1995

[blueprint core] importing spring context with custom namespace does not wait for NamespaceHandler to be registered

    XMLWordPrintableJSON

    Details

    • Type: Bug
    • Status: Resolved
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: blueprint-core-1.10.2
    • Fix Version/s: blueprint-core-1.10.3
    • Component/s: Blueprint
    • Labels:
      None

      Description

      In a blueprint application importing spring context with custom namespace using aries blueprint-spring integration does not wait for custom namespace.

      For example 

      with this blueprint context

      <blueprint xmlns="http://www.osgi.org/xmlns/blueprint/v1.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"<blueprint xmlns="http://www.osgi.org/xmlns/blueprint/v1.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:spring="http://www.springframework.org/schema/beans" xmlns:context="http://www.springframework.org/schema/context" xmlns:security="http://www.springframework.org/schema/security" xsi:schemaLocation="http://www.osgi.org/xmlns/blueprint/v1.0.0         http://www.osgi.org/xmlns/blueprint/v1.0.0/blueprint.xsd         http://www.springframework.org/schema/beans                         http://www.springframework.org/schema/beans/spring-beans.xsd" default-activation="eager" default-availability="mandatory">
       <spring:import resource="classpath:spring/security.xml" /></blueprint>

      importing this spring context

      <b:beans xmlns="http://www.springframework.org/schema/security"<b:beans xmlns="http://www.springframework.org/schema/security"  xmlns:b="http://www.springframework.org/schema/beans"  xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"  xsi:schemaLocation="http://www.springframework.org/schema/beans https://www.springframework.org/schema/beans/spring-beans.xsd http://www.springframework.org/schema/security https://www.springframework.org/schema/security/spring-security.xsd">
       <http />  <b:bean class="org.springframework.security.crypto.password.NoOpPasswordEncoder"/>
       <user-service> <user name="user" password="password" authorities="ROLE_USER" /> </user-service>
      </b:beans>

      fails with this stacktrace:

      java.lang.RuntimeException: org.springframework.beans.factory.parsing.BeanDefinitionParsingException: Configuration problem: Failed to import bean definitions from URL location [classpath:spring/security.xml] Offending resource: URL [bundleentry://103.fwk1077514876/OSGI-INF/blueprint/config.xml]; nested exception is org.springframework.beans.factory.parsing.BeanDefinitionParsingException: Configuration problem: Unable to locate Spring NamespaceHandler for XML schema namespace [http://www.springframework.org/schema/security] Offending resource: class path resource [spring/security.xml] at org.apache.aries.blueprint.spring.BlueprintNamespaceHandler.parse(BlueprintNamespaceHandler.java:132) at org.apache.aries.blueprint.parser.Parser.parseCustomElement(Parser.java:1369) at org.apache.aries.blueprint.parser.Parser.loadComponents(Parser.java:427) at org.apache.aries.blueprint.parser.Parser.populate(Parser.java:331) at org.apache.aries.blueprint.container.BlueprintContainerImpl.doRun(BlueprintContainerImpl.java:371) at org.apache.aries.blueprint.container.BlueprintContainerImpl.run(BlueprintContainerImpl.java:298) at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511) at java.util.concurrent.FutureTask.run(FutureTask.java:266) at org.apache.aries.blueprint.container.ExecutorServiceWrapper.run(ExecutorServiceWrapper.java:106) at org.apache.aries.blueprint.utils.threading.impl.DiscardableRunnable.run(DiscardableRunnable.java:45) at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511) at java.util.concurrent.FutureTask.run(FutureTask.java:266) at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.access$201(ScheduledThreadPoolExecutor.java:180) at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:293) at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624) at java.lang.Thread.run(Thread.java:748) Caused by: org.springframework.beans.factory.parsing.BeanDefinitionParsingException: Configuration problem: Failed to import bean definitions from URL location [classpath:spring/security.xml] Offending resource: URL [bundleentry://103.fwk1077514876/OSGI-INF/blueprint/config.xml]; nested exception is org.springframework.beans.factory.parsing.BeanDefinitionParsingException: Configuration problem: Unable to locate Spring NamespaceHandler for XML schema namespace [http://www.springframework.org/schema/security] Offending resource: class path resource [spring/security.xml] at org.springframework.beans.factory.parsing.FailFastProblemReporter.error(FailFastProblemReporter.java:72) at org.springframework.beans.factory.parsing.ReaderContext.error(ReaderContext.java:119) at org.springframework.beans.factory.parsing.ReaderContext.error(ReaderContext.java:104) at org.apache.aries.blueprint.spring.BeansNamespaceHandler$BeanDefinitionReader.importBeanDefinitionResource(BeansNamespaceHandler.java:256) at org.apache.aries.blueprint.spring.BeansNamespaceHandler$BeanDefinitionReader.parseDefaultElement(BeansNamespaceHandler.java:206) at org.apache.aries.blueprint.spring.BeansNamespaceHandler$BeanDefinitionReader.parseElement(BeansNamespaceHandler.java:135) at org.apache.aries.blueprint.spring.BeansNamespaceHandler.parse(BeansNamespaceHandler.java:55) at org.apache.aries.blueprint.spring.BlueprintNamespaceHandler.parse(BlueprintNamespaceHandler.java:114) ... 16 more Caused by: org.springframework.beans.factory.parsing.BeanDefinitionParsingException: Configuration problem: Unable to locate Spring NamespaceHandler for XML schema namespace [http://www.springframework.org/schema/security] Offending resource: class path resource [spring/security.xml] at org.springframework.beans.factory.parsing.FailFastProblemReporter.error(FailFastProblemReporter.java:72) at org.springframework.beans.factory.parsing.ReaderContext.error(ReaderContext.java:119) at org.springframework.beans.factory.parsing.ReaderContext.error(ReaderContext.java:111) at org.springframework.beans.factory.xml.BeanDefinitionParserDelegate.error(BeanDefinitionParserDelegate.java:281) at org.springframework.beans.factory.xml.BeanDefinitionParserDelegate.parseCustomElement(BeanDefinitionParserDelegate.java:1388) at org.springframework.beans.factory.xml.BeanDefinitionParserDelegate.parseCustomElement(BeanDefinitionParserDelegate.java:1371) at org.springframework.beans.factory.xml.DefaultBeanDefinitionDocumentReader.parseBeanDefinitions(DefaultBeanDefinitionDocumentReader.java:179) at org.springframework.beans.factory.xml.DefaultBeanDefinitionDocumentReader.doRegisterBeanDefinitions(DefaultBeanDefinitionDocumentReader.java:149) at org.springframework.beans.factory.xml.DefaultBeanDefinitionDocumentReader.registerBeanDefinitions(DefaultBeanDefinitionDocumentReader.java:96) at org.springframework.beans.factory.xml.XmlBeanDefinitionReader.registerBeanDefinitions(XmlBeanDefinitionReader.java:511) at org.springframework.beans.factory.xml.XmlBeanDefinitionReader.doLoadBeanDefinitions(XmlBeanDefinitionReader.java:391) at org.springframework.beans.factory.xml.XmlBeanDefinitionReader.loadBeanDefinitions(XmlBeanDefinitionReader.java:338) at org.springframework.beans.factory.xml.XmlBeanDefinitionReader.loadBeanDefinitions(XmlBeanDefinitionReader.java:310) at org.springframework.beans.factory.support.AbstractBeanDefinitionReader.loadBeanDefinitions(AbstractBeanDefinitionReader.java:241) at org.apache.aries.blueprint.spring.BeansNamespaceHandler$BeanDefinitionReader.importBeanDefinitionResource(BeansNamespaceHandler.java:250) ... 20 more
      

      A workaround is to define beans in custom namespace inside the blueprint context, then aries is waiting for custom namespace handler.

        Attachments

          Issue Links

            Activity

              People

              • Assignee:
                jbonofre Jean-Baptiste Onofré
                Reporter:
                amergey Arnaud MERGEY
              • Votes:
                0 Vote for this issue
                Watchers:
                2 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved: