metatech created ARIES-1286:
-------------------------------
Summary: Support for inner beans defined as "xsd:any" in custom
XMLs
Key: ARIES-1286
URL: https://issues.apache.org/jira/browse/ARIES-1286
Project: Aries
Issue Type: Bug
Components: Blueprint
Affects Versions: blueprint-core-1.0.1
Reporter: metatech
When a custom XSD defines a "xs:any" bean (for instance "shutdownHooks" in
ActiveMQ), Blueprint XML validation rejects it because the XML Validator cannot
find the XSD for the Blueprint core namespace
(http://www.osgi.org/xmlns/blueprint/v1.0.0).
This is because the BlueprintContainer, which calls the XSD validation,
extracts the XSD's from the various NamespaceHandler's which are used in the
XML. But the Blueprint core namespace is an exceptional case, because it does
not have a NamespaceHandler registered in the OSGi registry. Its XSD is
therefore missing from the "Schema" object.
To reproduce the problem, here are the steps :
Download samples and extract it :
http://apache.cu.be/aries/samples-1.0.0-source-release.zip
Replace file
samples-1.0.0\blueprint\helloworld\helloworld-client\src\main\resources\OSGI-INF\blueprint\config.xml
with attached, which adds an inner bean definition.
In directory
blueprint-samples-1.0.0-source-release\samples-1.0.0\blueprint\helloworld, do a
"mvn install"
In directory
blueprint-samples-1.0.0-source-release\samples-1.0.0\blueprint\helloworld\helloworld-assembly\target,
open org.apache.aries.blueprint-1.0.0.jar with a ZIP editor.
Browse to directory org/apache/aries/blueprint/ext/impl
Replace blueprint-ext.xsd with the attached version, which adds a "xsd:any"
element.
Run the test with
java -jar osgi-3.5.0.v20090520.jar -console
Type "ss" and check the ID for the bundles.
Start the bundle "org.apache.aries.samples.blueprint.helloworld.client_1.0.0"
{code}
[Blueprint Extender: 1] ERROR
org.apache.aries.blueprint.container.BlueprintContainerImpl - Unable to start
blueprint container for bundle
org.apache.aries.samples.blueprint.helloworld.client
org.osgi.service.blueprint.container.ComponentDefinitionException: Unable to
validate xml
at org.apache.aries.blueprint.parser.Parser.validate(Parser.java:288)
at
org.apache.aries.blueprint.container.BlueprintContainerImpl.doRun(BlueprintContainerImpl.java:291)
at
org.apache.aries.blueprint.container.BlueprintContainerImpl.run(BlueprintContainerImpl.java:242)
at
org.apache.aries.blueprint.utils.threading.impl.DiscardableRunnable.run(DiscardableRunnable.java:48)
at java.util.concurrent.Executors$RunnableAdapter.call(Unknown Source)
at java.util.concurrent.FutureTask.run(Unknown Source)
at
java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.access$201(Unknown
Source)
at
java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(Unknown
Source)
at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
at java.lang.Thread.run(Unknown Source)
Caused by: org.xml.sax.SAXParseException; cvc-complex-type.2.4.c: The matching
wildcard is strict, but no declaration can be found for element 'bean'.
at
com.sun.org.apache.xerces.internal.util.ErrorHandlerWrapper.createSAXParseException(Unknown
Source)
at
com.sun.org.apache.xerces.internal.util.ErrorHandlerWrapper.error(Unknown
Source)
at
com.sun.org.apache.xerces.internal.impl.XMLErrorReporter.reportError(Unknown
Source)
at
com.sun.org.apache.xerces.internal.impl.XMLErrorReporter.reportError(Unknown
Source)
at
com.sun.org.apache.xerces.internal.impl.XMLErrorReporter.reportError(Unknown
Source)
at
com.sun.org.apache.xerces.internal.impl.xs.XMLSchemaValidator$XSIErrorReporter.reportError(Unknown
Source)
at
com.sun.org.apache.xerces.internal.impl.xs.XMLSchemaValidator.reportSchemaError(Unknown
Source)
at
com.sun.org.apache.xerces.internal.impl.xs.XMLSchemaValidator.handleStartElement(Unknown
Source)
at
com.sun.org.apache.xerces.internal.impl.xs.XMLSchemaValidator.startElement(Unknown
Source)
at
com.sun.org.apache.xerces.internal.jaxp.validation.DOMValidatorHelper.beginNode(Unknown
Source)
at
com.sun.org.apache.xerces.internal.jaxp.validation.DOMValidatorHelper.validate(Unknown
Source)
at
com.sun.org.apache.xerces.internal.jaxp.validation.DOMValidatorHelper.validate(Unknown
Source)
at
com.sun.org.apache.xerces.internal.jaxp.validation.ValidatorImpl.validate(Unknown
Source)
at javax.xml.validation.Validator.validate(Unknown Source)
at org.apache.aries.blueprint.parser.Parser.validate(Parser.java:285)
... 10 more
{code}
--
This message was sent by Atlassian JIRA
(v6.3.4#6332)