[ https://issues.apache.org/jira/browse/ARIES-1995?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17170787#comment-17170787 ]
Arnaud MERGEY commented on ARIES-1995: -------------------------------------- I created a pull request that could help solve this [https://github.com/apache/aries/pull/111] > [blueprint core] importing spring context with custom namespace does not wait > for NamespaceHandler to be registered > ------------------------------------------------------------------------------------------------------------------- > > Key: ARIES-1995 > URL: https://issues.apache.org/jira/browse/ARIES-1995 > Project: Aries > Issue Type: Bug > Components: Blueprint > Affects Versions: blueprint-core-1.10.2 > Reporter: Arnaud MERGEY > Priority: Major > > 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 > {code:java} > <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>{code} > importing this spring context > {code:java} > <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>{code} > fails with this stacktrace: > {code:java} > 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 > {code} > A workaround is to define beans in custom namespace inside the blueprint > context, then aries is waiting for custom namespace handler. -- This message was sent by Atlassian Jira (v8.3.4#803005)