Details
-
Bug
-
Status: Closed
-
Trivial
-
Resolution: Not A Problem
-
5.1.0
-
None
-
None
-
Springsource DM 1.0.0.RC2, java jdk (sun) 1.6_07, Linux 32bit
-
Patch Available
Description
Hi!
I'm unable to use namespaces in spring xml files. It just cannot resolve namespacehttp://activemq.apache.org/schemas/core:
...
[2008-11-21 15:06:59.627] server-dm-7 rk.beans.factory.xml.DefaultBeanDefinitionDocumentReader.unknown D Loading bean definitions
[2008-11-21 15:06:59.628] server-dm-7 ramework.osgi.extender.internal.support.NamespacePlugins.unknown D Trying to resolving namespace handler for http://activemq.apache.org/schema/core
[2008-11-21 15:06:59.630] server-dm-7 .app.spring.GenericModuleOsgiBundleXmlApplicationContext.unknown E Pre refresh error
org.springframework.beans.factory.parsing.BeanDefinitionParsingException: Configuration problem: Unable to locate Spring NamespaceHandler for XML schema namespace http://activemq.apache.org/schema/core
Offending resource: URL [bundleentry://89/META-INF/spring/bundle-context-amq.xml]
at org.springframework.beans.factory.parsing.FailFastProblemReporter.error(FailFastProblemReporter.java:68)
at org.springframework.beans.factory.parsing.ReaderContext.error(ReaderContext.java:85)
at org.springframework.beans.factory.parsing.ReaderContext.error(ReaderContext.java:80)
at org.springframework.beans.factory.xml.BeanDefinitionParserDelegate.error(BeanDefinitionParserDelegate.java:281
...
To make long story short, it seems that in the process of building jar, someone forgot to move META-INF/services files in separate bundles.
In OSGI enviroment, classpath loader of one bundle can only see files in jars (bundles) which he has import directive, including local root. In current build of activemq, META-INF/services files are all stored in META-INF/services dir under activemq-core bundle.On the other hand, namespace parser is in xbean.spring bundle (referenced by META-INF/spring.handlers). Because parser is in separate bundle, it can not "see" META-INF/services directory, and it dies. Also, import for org.apache.xbean.spring.context.v2 is missing from activemq-core. Additionally, for bundle loader to scan for spring.schema file, bundle must import org.springframework.beans.factory.xml, which is also missing from manifest file. I'm not 100% shure in this, maybe all files from META-INF/services should be moved from activemq-core to xbaen.spring ...
Anyhow, fix to make it work is to:
- move META-INF/services in propriate bundles
- add following import to activemq-core:
org.springframework.beans.factory.xml;resolution:=optional,
org.apache.xbean.spring.context.v2;resolution:=optional
That's it for now.
H.