Quantcast
Channel: Apache Timeline
Viewing all articles
Browse latest Browse all 5648

ParamConverterProviders getting jumbled up between jaxrs:server and jaxrs:client on 2.7.1.1

$
0
0
Hi All,

I am facing a weird issue with CXF 2.7.11 (also in 2.7.3)

Say I have an app1 that exposes a certain method in Service1 like:

void doSomething(@QueryParam("input") SpecialObject1 obj)

and the XML configuration for this is as:
<jaxrs:server id="app1ServiceRS"
address="/app1ServiceRS">
<jaxrs:serviceBeans>
<ref bean="service1" />
</jaxrs:serviceBeans>
<jaxrs:providers>
<ref bean="jacksonJsonProvider"/>
<ref bean="app1ParamConverterProvider" />
</jaxrs:providers>
</jaxrs:server>

the app1ParamConverterProvider is the bean of a ParamConverterProvider
class in app1 that supplies the ParamConverter for handling SpecialObject1.
So far things work great. Now if this app1 needs to interact with another
app - app2 which exposes a method in Service2 like:

void doSomething(@QueryParam("inputThing") SpecialObject2 obj);

and the XML in app1 to access this as:
<jaxrs:client id="service2" serviceClass="com.kilo.Service2"
address="http://somehost:someport/app2ServiceRS">
<jaxrs:providers>
<ref bean="jacksonJsonProvider" />
<ref bean="app2ParamConverterProvider" />
</jaxrs:providers>
</jaxrs:client>

the app2ParamConverterProvider is a different bean of a
ParamConverterProvider class in app2 that supplies the ParamConverter for
handling SpecialObject2.

No other bus configuration is done - so everything else is default. When
any thread in app1 tries to access service2, somehow the control is passed
to app1ParamConverterProvider instead of app2ParamConverterProvider and the
call fails. Is this expected? From the docs at
http://cxf.apache.org/docs/jaxrs-services-configuration.html#JAXRSServicesConfiguration-Sharingprovidersbetweenmultipleendpoints
it seems that if the two providers are mentioned with different ids, then
they should not be shared and shouldn't cause one to be invoked with the
other.

This is somewhat random, but I think I have a test project (using jetty
container) where I am able to reproduce this consistently. Please let me
know if I am missing out on something elementary.

FWIW, I don't see this problem in CXF 3.0.0. Maybe because
ServerProviderFactory and ClientProviderFactory have been split up?

Thanks in advance!

Viewing all articles
Browse latest Browse all 5648

Trending Articles