XSD validator on Camel 2.10.0 with the xsd include schemalocation resolution ignores relative path

Solution Verified - Updated -

Issue

#1

The XSD include from an another include from a relative place does not work when migrating from Camel 2.8 to Camel 2.10.

We have 3 includes:

./xsd/sample.xsd
./xsd/common/include1.xsd
./xsd/common/include2.xsd

Sample includes include1 and include1 includes include2:

<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" elementFormDefault="qualified" attributeFormDefault="unqualified">
    <xs:include schemaLocation="common/include1.xsd"/>
    <xs:element name="sample">
        <xs:complexType>
            <xs:sequence>

include1.xsd:

<xs:include schemaLocation="include1.xsd"/>

Note that common is not included in the include1 file. This was working in 2.8 and since 2.9 fails:

Results in an error:

oTests run: 1, Failures: 0, Errors: 1, Skipped: 0, Time elapsed: 1.755 sec <<< FAILURE!
startTest(com.fusesource.sample.TestValidator) Time elapsed: 1.737 sec <<< ERROR!
org.apache.camel.FailedToCreateRouteException: Failed to create route route1 at: >>> To[validator:xsd/sample.xsd] <<< in route: Route[[Fromfile://sample/demo.xml] -> [To[validator:xsd/sa... because of Failed to resolve endpoint: validator://xsd/sample.xsd due to: java.io.FileNotFoundException: Cannot find resource in classpath for URI: xsd/include2.xsd
at org.apache.camel.model.RouteDefinition.addRoutes(RouteDefinition.java:873)
#2

Can not resolve relative path issue also mentioned in:

http://fusesource.com/issues/browse/ENTESB-801

The exception like:

Caused by: java.io.FileNotFoundException: Cannot find resource in classpath for URI: schema/../../../structures/2.0/structures.xsd
at org.apache.camel.util.ResourceHelper.resolveMandatoryResourceAsInputStream(ResourceHelper.java:106)[130:org.apache.camel.camel-core:2.10.0.redhat-60024]
at org.apache.camel.component.validator.DefaultLSResourceResolver$DefaultLSInput.getByteStream(DefaultLSResourceResolver.java:130)[130:org.apache.camel.camel-core:2.10.0.redhat-60024]
... 82 more

Now a patch for JBoss Fuse 6.0 avaliable in that JIRA.

Environment

  • Fuse Enterprise ESB 7.1
  • JBoss Fuse 6.0
  • Fuse Mediation Router 2.9.X, 2.10.X

Subscriber exclusive content

A Red Hat subscription provides unlimited access to our knowledgebase of over 48,000 articles and solutions.

Current Customers and Partners

Log in for full access

Log In
Close

Welcome! Check out the Getting Started with Red Hat page for quick tours and guides for common tasks.