CXFRS using JAXBProvider unable to load XSD schema in Fuse OSGi container

Solution Verified - Updated -

Issue

I am trying to validate incoming jaxrs requests using camel cxfrs endpoint with JAXBProvider and XSD schemas. The test case worked fine with unit test but failed when deploying to JBoss Fuse container with following error:

Caused by: java.lang.IllegalArgumentException: Cannot find XML schema location: xsd/Hello.xsd

Here is blueprint configuration xml snippet:

<cxf:rsServer id="restvalidation"
         address="http://localhost:20000"
         serviceClass="learn.rest.SayResource">
                <cxf:providers>
                        <ref component-id="jaxbProvider"/>
                </cxf:providers>
  </cxf:rsServer>

  <bean id="jaxbProvider" class="org.apache.cxf.jaxrs.provider.JAXBElementProvider">
    <property name="schemaLocations" ref="myschemas"/>
  </bean>

  <bean id="myschemas" class="java.util.ArrayList">
    <argument>
          <list>
            <value>/xsd/Hello.xsd</value>
          </list>
    </argument>
  </bean>

    <camelContext xmlns="http://camel.apache.org/schema/blueprint">
        <route id="my-cxf-route-data-validation">
                <from uri="cxfrs:bean:restvalidation"/>
                <log message="operation [${header.operationName}]"/>
                <setBody>
                        <simple>Hello ${body[0].title} ${body[0].name.given} ${body[0].name.family}</simple>
                </setBody>
        </route>
  </camelContext>

Environment

  • JBoss Fuse
    • 6.2.1

Subscriber exclusive content

A Red Hat subscription provides unlimited access to our knowledgebase, tools, and much more.

Current Customers and Partners

Log in for full access

Log In

New to Red Hat?

Learn more about Red Hat subscriptions

Using a Red Hat product through a public cloud?

How to access this content