Playing with xml catalogs,  found strage bug (or my misconfiguration, i
don't know)

When i place  my  catalog on default DEFAULT_CATALOG_LOCATION
(classpath:META-INF/jax-rs-catalog.xml),
it works in @SchemaValidation feature

but if I want to rename to custom location, eg
<bean id="jaxbProvider"
class="org.apache.cxf.jaxrs.provider.JAXBElementProvider">
...
        <property name="catalogLocation"
value="classpath:schemas/jparestresource/catalog.xml"/>
    </bean>
(and same for <bean id="jsonProvider"
class="org.apache.cxf.jaxrs.provider.json.JSONProvider"> )


It stops working.

I see in debugger that my value of catalogLocation passed to both providers
(enter to org.apache.cxf.jaxrs.provider.setSchemaLocations twice), but then
it initializes third provider (!)
with catalogLocation is set to null
and @SchemaValidation initailization fails (Cannot resolve the name '...'
to a(n) 'type definition' component. - this is becouse of catalog
unavaliable)
(also see  WARN  o.a.cxf.jaxrs.utils.ResourceUtils - No resource
classpath:META-INF/jax-rs-catalog.xml is available)

I look at org.apache.cxf.jaxrs.provider.ProviderFactory.initProviders and
see that there two copies of both providers (JAXB and JSON)
one with configured catalogLocation, and second with set to null

This is my configuration
https://github.com/ilb/jparestresource/blob/master/jparestresource-ws/src/main/webapp/WEB-INF/beans.xml

I have only two providers,
<bean id="jaxbProvider" class="
org.apache.cxf.jaxrs.provider.JAXBElementProvider">
and
<bean id="jsonProvider" class="
org.apache.cxf.jaxrs.provider.json.JSONProvider">

why I see unconfigured copies of these providers? who is placing them?

Reply via email to