You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@camel.apache.org by dumi_p <du...@gmail.com> on 2012/07/23 18:38:22 UTC

CxfRsProducer is not thread safe

Hi all,

I am using Camel 2.10.0 deployed on Tomcat 7 and I try to test following
scenario:

1. Have a CXF rest service deployed
2. Have a proxy CXF rest service over the service above, deployed under the
same Camel instance

It works fine, until I perform requests in parallel. Exception stacktrace is
attached.  http://camel.465427.n5.nabble.com/file/n5716351/stacktrace.txt
stacktrace.txt 

I tried following things in class
org.apache.camel.component.cxf.jaxrs.CxfRsProducer order to fix it:
1. Invoked JAXRSClientFactoryBean.setThreadSafe(true), with no success
2. Added synchronization point over line WebClient client =
cfb.createWebClient(), from invokeHttpClient method. It works, but
performance dropped on my localhost from 150 requests per second to 10
requests per second, so the fix is not acceptable.

I attach my camel-config.xml - please let me know if additional info is
needed. http://camel.465427.n5.nabble.com/file/n5716351/camel-config.xml
camel-config.xml 

I am not sure if the problem lies in the configuration I performed or in the
cxf-rs component or in cxf itself.

Any idea is appreciated.

Best regards,
Dumitru



--
View this message in context: http://camel.465427.n5.nabble.com/CxfRsProducer-is-not-thread-safe-tp5716351.html
Sent from the Camel - Users mailing list archive at Nabble.com.

Re: CxfRsProducer is not thread safe

Posted by dumi_p <du...@gmail.com>.
Hi,

I created the JIRA[1].

CamelRoute sample below:

/Dumitru

// Camel CXF Rest
from("cxfrs:bean:rsServer")
.to("log:input")
.to("cxfrs:bean:rsClient")
.to("log:output")
.process(new Processor() {
@Override
public void process(Exchange exchange) throws Exception {
log.info("Exchange output: {}", exchange);
if (exchange.getIn().getBody() instanceof Customer) {
Customer customer = exchange.getIn().getBody(
Customer.class);
Map headers = exchange.getIn().getHeaders();
 String name = customer.getName();
customer.setName(name + "123");

exchange.getOut().setBody(customer);
exchange.getOut().setHeaders(headers);
}
}
});

[1] https://issues.apache.org/jira/browse/CAMEL-5469

On Thu, Jul 26, 2012 at 5:43 AM, Willem.Jiang [via Camel] <
ml-node+s465427n5716499h90@n5.nabble.com> wrote:

> Dumitru do you mind to create a JIRA[1] here.
> It will be helpful for us to trace the issue.
>
> [1]https://issues.apache.org/jira/browse/CAMEL
>
> Willem
>
> On Thu, Jul 26, 2012 at 2:55 AM, dumi_p <[hidden email]<http://user/SendEmail.jtp?type=node&node=5716499&i=0>>
> wrote:
>
> > Hi Sergey,
> >
> > Sorry for the late response, I could not work today on the issue - other
> > things to do :-(. I will reproduce it tomorrow and send you the full
> code,
> > together with the JMX for JMeter load test.
> >
> > Note in my test, with 10 concurrent threads it was failing on more than
> 20
> > percent of the requests.
> >
> > Best regards,
> > /Dumitru
> >
> > On Wed, Jul 25, 2012 at 7:41 PM, Sergey Beryozkin-3 [via Camel] <
> > [hidden email] <http://user/SendEmail.jtp?type=node&node=5716499&i=1>>
> wrote:
> >
> >> As a sanity check I've run the multi-threaded test on the trunk and
> >> 2.9.x due to diff CXF versions being used there, still things work OK.
> >>
> >> Dumitru, I've been telling everyone CXF RS producer is broken :-), so
> >> need your help with reproducing the case. Are you having multiple
> >> threads running within a route builder itself ? Please provide more
> info
> >>
> >> Sergey
> >> On 25/07/12 14:44, Sergey Beryozkin wrote:
> >>
> >> > Dumitru,
> >> >
> >> > I'm not seeing in
> >> > http://camel.465427.n5.nabble.com/file/n5716351/camel-config.xml
> >> > how the route is initiated, can you provide the source of the updated
> >> > org.apache.camel.example.cxf.CamelRoute ?
> >> >
> >> > I've updated one of the tests which Willem created to get 500 threads
> >> > stressing the rs client code, can not reproduce the issue
> >> >
> >> > Cheers, Sergey
> >> >
> >> > On 24/07/12 02:45, Willem Jiang wrote:
> >> >> On Tue, Jul 24, 2012 at 6:16 AM, Sergey
> >> >> Beryozkin<[hidden email]<
> http://user/SendEmail.jtp?type=node&node=5716473&i=0>>wrote:
> >>
> >> >>
> >> >>> Hi
> >> >>>
> >> >>> On 23/07/12 17:38, dumi_p wrote:
> >> >>>
> >> >>>> Hi all,
> >> >>>>
> >> >>>> I am using Camel 2.10.0 deployed on Tomcat 7 and I try to test
> >> >>>> following
> >> >>>> scenario:
> >> >>>>
> >> >>>> 1. Have a CXF rest service deployed
> >> >>>> 2. Have a proxy CXF rest service over the service above, deployed
> >> under
> >> >>>> the
> >> >>>> same Camel instance
> >> >>>>
> >> >>>> It works fine, until I perform requests in parallel. Exception
> >> >>>> stacktrace
> >> >>>> is
> >> >>>> attached.
> >> >>>> http://camel.465427.n5.nabble.**com/file/n5716351/stacktrace.*
> >> >>>> *txt<
> http://camel.465427.n5.nabble.com/file/n5716351/stacktrace.txt>
> >> >>>> stacktrace.txt
> >> >>>>
> >> >>>> I tried following things in class
> >> >>>> org.apache.camel.component.**cxf.jaxrs.CxfRsProducer order to fix
> it:
> >> >>>> 1. Invoked JAXRSClientFactoryBean.**setThreadSafe(true), with no
> >> >>>> success
> >> >>>> 2. Added synchronization point over line WebClient client =
> >> >>>> cfb.createWebClient(), from invokeHttpClient method. It works, but
> >> >>>> performance dropped on my localhost from 150 requests per second
> to
> >> 10
> >> >>>> requests per second, so the fix is not acceptable.
> >> >>>>
> >> >>>> I attach my camel-config.xml - please let me know if additional
> info
> >> is
> >> >>>> needed. http://camel.465427.n5.nabble.**com/file/n5716351/camel-**
> >> >>>> config.xml<
> >> http://camel.465427.n5.nabble.com/file/n5716351/camel-config.xml>
> >> >>>>
> >> >>>> camel-config.xml
> >> >>>>
> >> >>>> I am not sure if the problem lies in the configuration I performed
> >> >>>> or in
> >> >>>> the
> >> >>>> cxf-rs component or in cxf itself.
> >> >>>>
> >> >>>> Any idea is appreciated.
> >> >>>>
> >> >>>> Well,I look at the code and see some JAXRSClientFactoryBean cache
> -
> >> >>> Willem can you comment on this please ? This looks suspicious.
> >> >>>
> >> >>
> >> >> I don't like the JAXRSClientFactoryBean cache either, it is used to
> >> >> create the WebClient if we change the URI per request. Now I just
> want
> >> to
> >> >> ask if there is a way to override the server address by setting the
> >> >> context
> >> >> per request in the WebClient.
> >> >>
> >> >> If So , it could easy for use to resolve the issue.
> >> >>
> >> >>
> >> >>> The trace shows that the thread safety is compromised at the point
> of
> >> >>> creating web clients. I can work on a patch - though will take me a
> >> >>> bit of
> >> >>> time to get to it
> >> >>>
> >> >>> Dumitru - any chance you can declare jaxrs:client or WebClient
> [1,2]
> >> >>> explicitly, with a thread safe flag set and reuse it in the routes
> >> >>> directly
> >> >>> ? That should do it.
> >> >>>
> >> >>> Thanks
> >> >>> Sergey
> >> >>>
> >> >>> [1]
> >> >>>
> http://cxf.apache.org/docs/**jax-rs-client-api.html#JAX-**RSClientAPI-
> >> >>> **ConfiguringHTTPclientsinSpring<
> >>
> http://cxf.apache.org/docs/jax-rs-client-api.html#JAX-RSClientAPI-ConfiguringHTTPclientsinSpring>
>
> >>
> >> >>>
> >> >>> [2]
> >> >>>
> http://cxf.apache.org/docs/**jax-rs-client-api.html#JAX-**RSClientAPI-
> >> >>> **ConfiguringproxiesinSpring<
> >>
> http://cxf.apache.org/docs/jax-rs-client-api.html#JAX-RSClientAPI-ConfiguringproxiesinSpring>
>
> >>
> >> >>>
> >> >>> [2]
> >> >>>
> >> >>>
> >> >>> Best regards,
> >> >>>> Dumitru
> >> >>>>
> >> >>>>
> >> >>>>
> >> >>>> --
> >> >>>> View this message in context: http://camel.465427.n5.nabble.**
> >> >>>> com/CxfRsProducer-is-not-**thread-safe-tp5716351.html<
> >>
> http://camel.465427.n5.nabble.com/CxfRsProducer-is-not-thread-safe-tp5716351.html>
>
> >>
> >> >>>>
> >> >>>> Sent from the Camel - Users mailing list archive at Nabble.com.
> >> >>>>
> >> >>>
> >> >>>
> >> >>
> >>
> >>
> >>
> >> ------------------------------
> >>  If you reply to this email, your message will be added to the
> discussion
> >> below:
> >>
> >>
>
> >> .
> >> NAML<
> http://camel.465427.n5.nabble.com/template/NamlServlet.jtp?macro=macro_viewer&id=instant_html%21nabble%3Aemail.naml&base=nabble.naml.namespaces.BasicNamespace-nabble.view.web.template.NabbleNamespace-nabble.view.web.template.NodeNamespace&breadcrumbs=notify_subscribers%21nabble%3Aemail.naml-instant_emails%21nabble%3Aemail.naml-send_instant_email%21nabble%3Aemail.naml>
>
> >>
> >
> >
> >
> >
> > --
> > View this message in context:
> http://camel.465427.n5.nabble.com/CxfRsProducer-is-not-thread-safe-tp5716351p5716475.html
>
> > Sent from the Camel - Users mailing list archive at Nabble.com.
>
>
> ------------------------------
>  If you reply to this email, your message will be added to the discussion
> below:
>
> http://camel.465427.n5.nabble.com/CxfRsProducer-is-not-thread-safe-tp5716351p5716499.html
>  To unsubscribe from CxfRsProducer is not thread safe, click here<http://camel.465427.n5.nabble.com/template/NamlServlet.jtp?macro=unsubscribe_by_code&node=5716351&code=ZHVtaXRydS5wYXNjdUBnbWFpbC5jb218NTcxNjM1MXwtMTk2Nzc0NjQwNQ==>
> .
> NAML<http://camel.465427.n5.nabble.com/template/NamlServlet.jtp?macro=macro_viewer&id=instant_html%21nabble%3Aemail.naml&base=nabble.naml.namespaces.BasicNamespace-nabble.view.web.template.NabbleNamespace-nabble.view.web.template.NodeNamespace&breadcrumbs=notify_subscribers%21nabble%3Aemail.naml-instant_emails%21nabble%3Aemail.naml-send_instant_email%21nabble%3Aemail.naml>
>




--
View this message in context: http://camel.465427.n5.nabble.com/CxfRsProducer-is-not-thread-safe-tp5716351p5716502.html
Sent from the Camel - Users mailing list archive at Nabble.com.

Re: CxfRsProducer is not thread safe

Posted by dumi_p <du...@gmail.com>.
Thank you, Sergey for your help!

I used your unit tests and tried to reproduce the problem, yet without
success. Still, one can reproduce the issue using JMeter and the working
project I've attached in the jira issue.

Regards,
Dumitru

On Sun, Aug 5, 2012 at 6:36 PM, Sergey Beryozkin-3 [via Camel] <
ml-node+s465427n5716844h85@n5.nabble.com> wrote:

> HI Dumitru
>
> On 05/08/12 00:44, dumi_p wrote:
> > Thank you, that did it: added cglib and operation name for the bean
> route.
> OK, thanks for the confirmation. I think I need to get a permission to
> update the Camel wiki and add some additional info on how CXF JAX-RS
> code can work with core Camel components (bean comp, camel transport)
> >
> > Although for the moment it works, I don't necessarily like adding the
> > method name in the route, as I would have preferred to have the proxy
> more
> > generic - for all methods exposed by the webservice in the backend.
> >
> Sure; you may also want to try to instantiate a CXF WebClient as a bean,
> in which case it can be a bit simpler to offer a generic route, with
> only the webclient path changing, etc
> > I ran the test you've send me and surprisingly it does not fail although
> it
> > seems almost identical to my case. I will look more into it tomorrow.
> >
> Thanks;
> Cheers, Sergey
>
> > Best regards,
> > /Dumitru
> >
> > On Fri, Aug 3, 2012 at 10:42 AM, Sergey Beryozkin-3 [via Camel]<
> > [hidden email] <http://user/SendEmail.jtp?type=node&node=5716844&i=0>>
>  wrote:
> >
> >> On 03/08/12 10:26, Sergey Beryozkin wrote:
> >>
> >>> Hi
> >>> On 02/08/12 23:42, dumi_p wrote:
> >>>> Hi,
> >>>>
> >>>> In the mean time, I tried to use jaxrs:client, but got into another
> >>>> problem. Seems like<jaxrs:client>  accepts only interfaces for the
> >>>> serviceClass attribute, so I created a new interface
> >>>
> >>> it can create proxies from concrete classes, but it needs a
> cglib-nodep
> >>> for it to work.
> >>>
> >>>> (CustomerServiceInterface) and configured it as it follows:
> >>>> <jaxrs:client id="rsClient"
> >>>> address="
> >> http://localhost:8080/camel-example-cxf-tomcat/webservices/rest"
> >>>>
> >>
> serviceClass="org.apache.camel.example.cxf.restobjects.CustomerServiceInterface"
>
> >>
> >>>>
> >>>> inheritHeaders="true">
> >>>> <jaxrs:headers>
> >>>> <entry key="Accept" value="text/xml" />
> >>>> </jaxrs:headers>
> >>>> </jaxrs:client>
> >>>>
> >>>
> >>> add a 'threadSafe' flag please
> >>>
> >>>> Route is:
> >>>> from("cxfrs:bean:rsServer")
> >>>> .to("log:input")
> >>>> .to("bean:rsClient")
> >>>> .to("log:output");
> >>>>
> >>>> Error I get is:
> >>>
> >>> I think the exception below suggests a camel bean component can not
> >>> invoke on proxies.
> >>>
> >>
> >> Actually, it seems more to do with the misconfiguration, according to
> >> http://camel.apache.org/bean.html
> >>
> >> one needs to specify a 'method' parameter
> >>
> >> Try it please
> >> Sergey
> >>
> >>> Cheers, Sergey
> >>>
> >>> P.S. Btw, if you can get a chance, please try a test code I attached
> to
> >>> JIRA. I do not dispute the fact you saw the thread-safety related
> >>> exception but I need to create a failing test to start with :-) and
> the
> >>> test I did mimics the way your route works very closely
> >>>
> >>>> 2012-08-02 23:31:20,894 [http-8080-1 ] ERROR DefaultErrorHandler
> >>>> - Failed delivery for (MessageId: ID-Dumi-PC-57364-1343939398047-0-1
> on
> >>>> ExchangeId: ID-Dumi-PC-57364-1343939398047-0-2). Exhausted after
> >> delivery
> >>>> attempt: 1 caught:
> >>>> org.apache.camel.component.bean.AmbiguousMethodCallException:
> Ambiguous
> >>>> method invocations possible: [public final
> >>>> org.apache.camel.example.cxf.restobjects.Customer
> >>>> $Proxy49.getCustomer(java.lang.String), public final
> >>>> org.apache.camel.example.cxf.restobjects.Customer
> >>>> $Proxy49.getCustomer(java.lang.String)]. Exchange[Message: 123]
> >>>> org.apache.camel.component.bean.AmbiguousMethodCallException:
> Ambiguous
> >>>> method invocations possible: [public final
> >>>> org.apache.camel.example.cxf.restobjects.Customer
> >>>> $Proxy49.getCustomer(java.lang.String), public final
> >>>> org.apache.camel.example.cxf.restobjects.Customer
> >>>> $Proxy49.getCustomer(java.lang.String)]. Exchange[Message: 123]
> >>>> at
> >>>>
> >>
> org.apache.camel.component.bean.BeanInfo.chooseBestPossibleMethodInfo(BeanInfo.java:587)[camel-core-2.10.0.jar:2.10.0]
>
> >>
> >>>>
> >>>> at
> >>>>
> >>
> org.apache.camel.component.bean.BeanInfo.chooseMethodWithMatchingBody(BeanInfo.java:544)[camel-core-2.10.0.jar:2.10.0]
>
> >>
> >>>>
> >>>> at
> >>>>
> >>
> org.apache.camel.component.bean.BeanInfo.chooseMethod(BeanInfo.java:496)[camel-core-2.10.0.jar:2.10.0]
>
> >>
> >>>>
> >>>> at
> >>>>
> >>
> org.apache.camel.component.bean.BeanInfo.createInvocation(BeanInfo.java:225)[camel-core-2.10.0.jar:2.10.0]
>
> >>
> >>>>
> >>>> at
> >>>>
> >>
> org.apache.camel.component.bean.BeanInfo.createInvocation(BeanInfo.java:162)[camel-core-2.10.0.jar:2.10.0]
>
> >>
> >>>>
> >>>> at
> >>>>
> >>
> org.apache.camel.component.bean.BeanProcessor.process(BeanProcessor.java:149)[camel-core-2.10.0.jar:2.10.0]
>
> >>
> >>>>
> >>>> at
> >>>>
> >>
> org.apache.camel.util.AsyncProcessorHelper.process(AsyncProcessorHelper.java:99)[camel-core-2.10.0.jar:2.10.0]
>
> >>
> >>>>
> >>>> at
> >>>>
> >>
> org.apache.camel.component.bean.BeanProcessor.process(BeanProcessor.java:73)[camel-core-2.10.0.jar:2.10.0]
>
> >>
> >>>>
> >>>> at
> >>>>
> >>
> org.apache.camel.impl.ProcessorEndpoint.onExchange(ProcessorEndpoint.java:101)[camel-core-2.10.0.jar:2.10.0]
>
> >>
> >>>>
> >>>> at
> >>>>
> >>
> org.apache.camel.impl.ProcessorEndpoint$1.process(ProcessorEndpoint.java:71)[camel-core-2.10.0.jar:2.10.0]
>
> >>
> >>>>
> >>>> at
> >>>>
> >>
> org.apache.camel.util.AsyncProcessorConverterHelper$ProcessorToAsyncProcessorBridge.process(AsyncProcessorConverterHelper.java:61)[camel-core-2.10.0.jar:2.10.0]
>
> >>
> >>>>
> >>>> at
> >>>>
> >>
> org.apache.camel.util.AsyncProcessorHelper.process(AsyncProcessorHelper.java:73)[camel-core-2.10.0.jar:2.10.0]
>
> >>
> >>>>
> >>>> at
> >>>>
> >>
> org.apache.camel.processor.SendProcessor$2.doInAsyncProducer(SendProcessor.java:120)[camel-core-2.10.0.jar:2.10.0]
>
> >>
> >>>>
> >>>> at
> >>>>
> >>
> org.apache.camel.impl.ProducerCache.doInAsyncProducer(ProducerCache.java:292)[camel-core-2.10.0.jar:2.10.0]
>
> >>
> >>>>
> >>>> at
> >>>>
> >>
> org.apache.camel.processor.SendProcessor.process(SendProcessor.java:115)[camel-core-2.10.0.jar:2.10.0]
>
> >>
> >>>>
> >>>> at
> >>>>
> >>
> org.apache.camel.util.AsyncProcessorHelper.process(AsyncProcessorHelper.java:73)[camel-core-2.10.0.jar:2.10.0]
>
> >>
> >>>>
> >>>> at
> >>>>
> >>
> org.apache.camel.processor.DelegateAsyncProcessor.processNext(DelegateAsyncProcessor.java:99)[camel-core-2.10.0.jar:2.10.0]
>
> >>
> >>>>
> >>>> at
> >>>>
> >>
> org.apache.camel.processor.DelegateAsyncProcessor.process(DelegateAsyncProcessor.java:90)[camel-core-2.10.0.jar:2.10.0]
>
> >>
> >>>>
> >>>> at
> >>>>
> >>
> org.apache.camel.management.InstrumentationProcessor.process(InstrumentationProcessor.java:73)[camel-core-2.10.0.jar:2.10.0]
>
> >>
> >>>>
> >>>> at
> >>>>
> >>
> org.apache.camel.util.AsyncProcessorHelper.process(AsyncProcessorHelper.java:73)[camel-core-2.10.0.jar:2.10.0]
>
> >>
> >>>>
> >>>> at
> >>>>
> >>
> org.apache.camel.processor.DelegateAsyncProcessor.processNext(DelegateAsyncProcessor.java:99)[camel-core-2.10.0.jar:2.10.0]
>
> >>
> >>>>
> >>>> at
> >>>>
> >>
> org.apache.camel.processor.DelegateAsyncProcessor.process(DelegateAsyncProcessor.java:90)[camel-core-2.10.0.jar:2.10.0]
>
> >>
> >>>>
> >>>> at
> >>>>
> >>
> org.apache.camel.processor.interceptor.TraceInterceptor.process(TraceInterceptor.java:91)[camel-core-2.10.0.jar:2.10.0]
>
> >>
> >>>>
> >>>> at
> >>>>
> >>
> org.apache.camel.util.AsyncProcessorHelper.process(AsyncProcessorHelper.java:73)[camel-core-2.10.0.jar:2.10.0]
>
> >>
> >>>>
> >>>> at
> >>>>
> >>
> org.apache.camel.processor.RedeliveryErrorHandler.processErrorHandler(RedeliveryErrorHandler.java:330)[camel-core-2.10.0.jar:2.10.0]
>
> >>
> >>>>
> >>>> at
> >>>>
> >>
> org.apache.camel.processor.RedeliveryErrorHandler.process(RedeliveryErrorHandler.java:220)[camel-core-2.10.0.jar:2.10.0]
>
> >>
> >>>>
> >>>> at
> >>>>
> >>
> org.apache.camel.processor.RouteContextProcessor.processNext(RouteContextProcessor.java:45)[camel-core-2.10.0.jar:2.10.0]
>
> >>
> >>>>
> >>>> at
> >>>>
> >>
> org.apache.camel.processor.DelegateAsyncProcessor.process(DelegateAsyncProcessor.java:90)[camel-core-2.10.0.jar:2.10.0]
>
> >>
> >>>>
> >>>> at
> >>>>
> >>
> org.apache.camel.processor.interceptor.DefaultChannel.process(DefaultChannel.java:303)[camel-core-2.10.0.jar:2.10.0]
>
> >>
> >>>>
> >>>> at
> >>>>
> >>
> org.apache.camel.util.AsyncProcessorHelper.process(AsyncProcessorHelper.java:73)[camel-core-2.10.0.jar:2.10.0]
>
> >>
> >>>>
> >>>> at
> >>>>
> >>
> org.apache.camel.processor.Pipeline.process(Pipeline.java:117)[camel-core-2.10.0.jar:2.10.0]
>
> >>
> >>>>
> >>>> at
> >>>>
> >>
> org.apache.camel.processor.Pipeline.process(Pipeline.java:80)[camel-core-2.10.0.jar:2.10.0]
>
> >>
> >>>>
> >>>> at
> >>>>
> >>
> org.apache.camel.processor.RouteContextProcessor.processNext(RouteContextProcessor.java:45)[camel-core-2.10.0.jar:2.10.0]
>
> >>
> >>>>
> >>>> at
> >>>>
> >>
> org.apache.camel.processor.DelegateAsyncProcessor.process(DelegateAsyncProcessor.java:90)[camel-core-2.10.0.jar:2.10.0]
>
> >>
> >>>>
> >>>> at
> >>>>
> >>
> org.apache.camel.processor.UnitOfWorkProcessor.processAsync(UnitOfWorkProcessor.java:150)[camel-core-2.10.0.jar:2.10.0]
>
> >>
> >>>>
> >>>> at
> >>>>
> >>
> org.apache.camel.processor.UnitOfWorkProcessor.process(UnitOfWorkProcessor.java:117)[camel-core-2.10.0.jar:2.10.0]
>
> >>
> >>>>
> >>>> at
> >>>>
> >>
> org.apache.camel.processor.RouteInflightRepositoryProcessor.processNext(RouteInflightRepositoryProcessor.java:48)[camel-core-2.10.0.jar:2.10.0]
>
> >>
> >>>>
> >>>> at
> >>>>
> >>
> org.apache.camel.processor.DelegateAsyncProcessor.process(DelegateAsyncProcessor.java:90)[camel-core-2.10.0.jar:2.10.0]
>
> >>
> >>>>
> >>>> at
> >>>>
> >>
> org.apache.camel.util.AsyncProcessorHelper.process(AsyncProcessorHelper.java:73)[camel-core-2.10.0.jar:2.10.0]
>
> >>
> >>>>
> >>>> at
> >>>>
> >>
> org.apache.camel.processor.DelegateAsyncProcessor.processNext(DelegateAsyncProcessor.java:99)[camel-core-2.10.0.jar:2.10.0]
>
> >>
> >>>>
> >>>> at
> >>>>
> >>
> org.apache.camel.processor.DelegateAsyncProcessor.process(DelegateAsyncProcessor.java:90)[camel-core-2.10.0.jar:2.10.0]
>
> >>
> >>>>
> >>>> at
> >>>>
> >>
> org.apache.camel.management.InstrumentationProcessor.process(InstrumentationProcessor.java:73)[camel-core-2.10.0.jar:2.10.0]
>
> >>
> >>>>
> >>>> at
> >>>>
> >>
> org.apache.camel.util.AsyncProcessorHelper.process(AsyncProcessorHelper.java:99)[camel-core-2.10.0.jar:2.10.0]
>
> >>
> >>>>
> >>>> at
> >>>>
> >>
> org.apache.camel.processor.DelegateAsyncProcessor.process(DelegateAsyncProcessor.java:86)[camel-core-2.10.0.jar:2.10.0]
>
> >>
> >>>>
> >>>> at
> >>>>
> >>
> org.apache.camel.component.cxf.jaxrs.CxfRsInvoker.syncInvoke(CxfRsInvoker.java:122)[camel-cxf-2.10.0.jar:2.10.0]
>
> >>
> >>>>
> >>>> at
> >>>>
> >>
> org.apache.camel.component.cxf.jaxrs.CxfRsInvoker.performInvocation(CxfRsInvoker.java:60)[camel-cxf-2.10.0.jar:2.10.0]
>
> >>
> >>>>
> >>>> at
> >>>>
> >>
> org.apache.cxf.service.invoker.AbstractInvoker.invoke(AbstractInvoker.java:96)[cxf-api-2.6.1.jar:2.6.1]
>
> >>
> >>>>
> >>>> at
> >>>>
> >>
> org.apache.cxf.jaxrs.JAXRSInvoker.invoke(JAXRSInvoker.java:167)[cxf-rt-frontend-jaxrs-2.6.1.jar:2.6.1]
>
> >>
> >>>>
> >>>> at
> >>>>
> >>
> org.apache.cxf.jaxrs.JAXRSInvoker.invoke(JAXRSInvoker.java:94)[cxf-rt-frontend-jaxrs-2.6.1.jar:2.6.1]
>
> >>
> >>>>
> >>>> at
> >>>>
> >>
> org.apache.cxf.interceptor.ServiceInvokerInterceptor$1.run(ServiceInvokerInterceptor.java:58)[cxf-api-2.6.1.jar:2.6.1]
>
> >>
> >>>>
> >>>> at
> >>>>
> >>
> org.apache.cxf.interceptor.ServiceInvokerInterceptor.handleMessage(ServiceInvokerInterceptor.java:94)[cxf-api-2.6.1.jar:2.6.1]
>
> >>
> >>>>
> >>>> at
> >>>>
> >>
> org.apache.cxf.phase.PhaseInterceptorChain.doIntercept(PhaseInterceptorChain.java:262)[cxf-api-2.6.1.jar:2.6.1]
>
> >>
> >>>>
> >>>> at
> >>>>
> >>
> org.apache.cxf.transport.ChainInitiationObserver.onMessage(ChainInitiationObserver.java:122)[cxf-api-2.6.1.jar:2.6.1]
>
> >>
> >>>>
> >>>> at
> >>>>
> >>
> org.apache.cxf.transport.http.AbstractHTTPDestination.invoke(AbstractHTTPDestination.java:211)[cxf-rt-transports-http-2.6.1.jar:2.6.1]
>
> >>
> >>>>
> >>>> at
> >>>>
> >>
> org.apache.cxf.transport.servlet.ServletController.invokeDestination(ServletController.java:213)[cxf-rt-transports-http-2.6.1.jar:2.6.1]
>
> >>
> >>>>
> >>>> at
> >>>>
> >>
> org.apache.cxf.transport.servlet.ServletController.invoke(ServletController.java:154)[cxf-rt-transports-http-2.6.1.jar:2.6.1]
>
> >>
> >>>>
> >>>> at
> >>>>
> >>
> org.apache.cxf.transport.servlet.CXFNonSpringServlet.invoke(CXFNonSpringServlet.java:129)[cxf-rt-transports-http-2.6.1.jar:2.6.1]
>
> >>
> >>>>
> >>>> at
> >>>>
> >>
> org.apache.cxf.transport.servlet.AbstractHTTPServlet.handleRequest(AbstractHTTPServlet.java:187)[cxf-rt-transports-http-2.6.1.jar:2.6.1]
>
> >>
> >>>>
> >>>> at
> >>>>
> >>
> org.apache.cxf.transport.servlet.AbstractHTTPServlet.doGet(AbstractHTTPServlet.java:115)[cxf-rt-transports-http-2.6.1.jar:2.6.1]
>
> >>
> >>>>
> >>>> at
> >>>>
> >>
> javax.servlet.http.HttpServlet.service(HttpServlet.java:617)[servlet-api-6.0.29.jar:]
>
> >>
> >>>>
> >>>> at
> >>>>
> >>
> org.apache.cxf.transport.servlet.AbstractHTTPServlet.service(AbstractHTTPServlet.java:166)[cxf-rt-transports-http-2.6.1.jar:2.6.1]
>
> >>
> >>>>
> >>>> at
> >>>>
> >>
> org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)[catalina-6.0.29.jar:6.0.29]
>
> >>
> >>>>
> >>>> at
> >>>>
> >>
> org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)[catalina-6.0.29.jar:6.0.29]
>
> >>
> >>>>
> >>>> at
> >>>>
> >>
> org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:233)[catalina-6.0.29.jar:6.0.29]
>
> >>
> >>>>
> >>>> at
> >>>>
> >>
> org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:191)[catalina-6.0.29.jar:6.0.29]
>
> >>
> >>>>
> >>>> at
> >>>>
> >>
> org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:127)[catalina-6.0.29.jar:6.0.29]
>
> >>
> >>>>
> >>>> at
> >>>>
> >>
> org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)[catalina-6.0.29.jar:6.0.29]
>
> >>
> >>>>
> >>>> at
> >>>>
> >>
> org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)[catalina-6.0.29.jar:6.0.29]
>
> >>
> >>>>
> >>>> at
> >>>>
> >>
> org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:298)[catalina-6.0.29.jar:6.0.29]
>
> >>
> >>>>
> >>>> at
> >>>>
> >>
> org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:857)[coyote-6.0.29.jar:6.0.29]
>
> >>
> >>>>
> >>>> at
> >>>>
> >>
> org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:588)[coyote-6.0.29.jar:6.0.29]
>
> >>
> >>>>
> >>>> at
> >>>>
> >>
> org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:489)[coyote-6.0.29.jar:6.0.29]
>
> >>
> >>>>
> >>>>
> >>>> Attached relevant files.
> >>>>
> >>>> Any help appreciated.
> >>>>
> >>>> Regards,
> >>>> /Dumitru
> >>>>
> >>>>
> >>>>
> >>>>
> >>>> --
> >>>> View this message in context:
> >>>>
> >>
> http://camel.465427.n5.nabble.com/CxfRsProducer-is-not-thread-safe-tp5716351p5716712.html
> >>>>
> >>>> Sent from the Camel - Users mailing list archive at Nabble.com.
> >>>
> >>
> >>
> >> ------------------------------
> >>   If you reply to this email, your message will be added to the
> discussion
> >> below:
> >>
> >>
>
> >> .
> >> NAML<
> http://camel.465427.n5.nabble.com/template/NamlServlet.jtp?macro=macro_viewer&id=instant_html%21nabble%3Aemail.naml&base=nabble.naml.namespaces.BasicNamespace-nabble.view.web.template.NabbleNamespace-nabble.view.web.template.NodeNamespace&breadcrumbs=notify_subscribers%21nabble%3Aemail.naml-instant_emails%21nabble%3Aemail.naml-send_instant_email%21nabble%3Aemail.naml>
>
> >>
> >
> >
> >
> >
> > --
> > View this message in context:
> http://camel.465427.n5.nabble.com/CxfRsProducer-is-not-thread-safe-tp5716351p5716836.html
>
> > Sent from the Camel - Users mailing list archive at Nabble.com.
>
>
> ------------------------------
>  If you reply to this email, your message will be added to the discussion
> below:
>
> http://camel.465427.n5.nabble.com/CxfRsProducer-is-not-thread-safe-tp5716351p5716844.html
>  To unsubscribe from CxfRsProducer is not thread safe, click here<http://camel.465427.n5.nabble.com/template/NamlServlet.jtp?macro=unsubscribe_by_code&node=5716351&code=ZHVtaXRydS5wYXNjdUBnbWFpbC5jb218NTcxNjM1MXwtMTk2Nzc0NjQwNQ==>
> .
> NAML<http://camel.465427.n5.nabble.com/template/NamlServlet.jtp?macro=macro_viewer&id=instant_html%21nabble%3Aemail.naml&base=nabble.naml.namespaces.BasicNamespace-nabble.view.web.template.NabbleNamespace-nabble.view.web.template.NodeNamespace&breadcrumbs=notify_subscribers%21nabble%3Aemail.naml-instant_emails%21nabble%3Aemail.naml-send_instant_email%21nabble%3Aemail.naml>
>




--
View this message in context: http://camel.465427.n5.nabble.com/CxfRsProducer-is-not-thread-safe-tp5716351p5716895.html
Sent from the Camel - Users mailing list archive at Nabble.com.

Re: CxfRsProducer is not thread safe

Posted by Sergey Beryozkin <sb...@gmail.com>.
HI Dumitru

On 05/08/12 00:44, dumi_p wrote:
> Thank you, that did it: added cglib and operation name for the bean route.
OK, thanks for the confirmation. I think I need to get a permission to 
update the Camel wiki and add some additional info on how CXF JAX-RS 
code can work with core Camel components (bean comp, camel transport)
>
> Although for the moment it works, I don't necessarily like adding the
> method name in the route, as I would have preferred to have the proxy more
> generic - for all methods exposed by the webservice in the backend.
>
Sure; you may also want to try to instantiate a CXF WebClient as a bean, 
in which case it can be a bit simpler to offer a generic route, with 
only the webclient path changing, etc
> I ran the test you've send me and surprisingly it does not fail although it
> seems almost identical to my case. I will look more into it tomorrow.
>
Thanks;
Cheers, Sergey

> Best regards,
> /Dumitru
>
> On Fri, Aug 3, 2012 at 10:42 AM, Sergey Beryozkin-3 [via Camel]<
> ml-node+s465427n5716752h33@n5.nabble.com>  wrote:
>
>> On 03/08/12 10:26, Sergey Beryozkin wrote:
>>
>>> Hi
>>> On 02/08/12 23:42, dumi_p wrote:
>>>> Hi,
>>>>
>>>> In the mean time, I tried to use jaxrs:client, but got into another
>>>> problem. Seems like<jaxrs:client>  accepts only interfaces for the
>>>> serviceClass attribute, so I created a new interface
>>>
>>> it can create proxies from concrete classes, but it needs a cglib-nodep
>>> for it to work.
>>>
>>>> (CustomerServiceInterface) and configured it as it follows:
>>>> <jaxrs:client id="rsClient"
>>>> address="
>> http://localhost:8080/camel-example-cxf-tomcat/webservices/rest"
>>>>
>> serviceClass="org.apache.camel.example.cxf.restobjects.CustomerServiceInterface"
>>
>>>>
>>>> inheritHeaders="true">
>>>> <jaxrs:headers>
>>>> <entry key="Accept" value="text/xml" />
>>>> </jaxrs:headers>
>>>> </jaxrs:client>
>>>>
>>>
>>> add a 'threadSafe' flag please
>>>
>>>> Route is:
>>>> from("cxfrs:bean:rsServer")
>>>> .to("log:input")
>>>> .to("bean:rsClient")
>>>> .to("log:output");
>>>>
>>>> Error I get is:
>>>
>>> I think the exception below suggests a camel bean component can not
>>> invoke on proxies.
>>>
>>
>> Actually, it seems more to do with the misconfiguration, according to
>> http://camel.apache.org/bean.html
>>
>> one needs to specify a 'method' parameter
>>
>> Try it please
>> Sergey
>>
>>> Cheers, Sergey
>>>
>>> P.S. Btw, if you can get a chance, please try a test code I attached to
>>> JIRA. I do not dispute the fact you saw the thread-safety related
>>> exception but I need to create a failing test to start with :-) and the
>>> test I did mimics the way your route works very closely
>>>
>>>> 2012-08-02 23:31:20,894 [http-8080-1 ] ERROR DefaultErrorHandler
>>>> - Failed delivery for (MessageId: ID-Dumi-PC-57364-1343939398047-0-1 on
>>>> ExchangeId: ID-Dumi-PC-57364-1343939398047-0-2). Exhausted after
>> delivery
>>>> attempt: 1 caught:
>>>> org.apache.camel.component.bean.AmbiguousMethodCallException: Ambiguous
>>>> method invocations possible: [public final
>>>> org.apache.camel.example.cxf.restobjects.Customer
>>>> $Proxy49.getCustomer(java.lang.String), public final
>>>> org.apache.camel.example.cxf.restobjects.Customer
>>>> $Proxy49.getCustomer(java.lang.String)]. Exchange[Message: 123]
>>>> org.apache.camel.component.bean.AmbiguousMethodCallException: Ambiguous
>>>> method invocations possible: [public final
>>>> org.apache.camel.example.cxf.restobjects.Customer
>>>> $Proxy49.getCustomer(java.lang.String), public final
>>>> org.apache.camel.example.cxf.restobjects.Customer
>>>> $Proxy49.getCustomer(java.lang.String)]. Exchange[Message: 123]
>>>> at
>>>>
>> org.apache.camel.component.bean.BeanInfo.chooseBestPossibleMethodInfo(BeanInfo.java:587)[camel-core-2.10.0.jar:2.10.0]
>>
>>>>
>>>> at
>>>>
>> org.apache.camel.component.bean.BeanInfo.chooseMethodWithMatchingBody(BeanInfo.java:544)[camel-core-2.10.0.jar:2.10.0]
>>
>>>>
>>>> at
>>>>
>> org.apache.camel.component.bean.BeanInfo.chooseMethod(BeanInfo.java:496)[camel-core-2.10.0.jar:2.10.0]
>>
>>>>
>>>> at
>>>>
>> org.apache.camel.component.bean.BeanInfo.createInvocation(BeanInfo.java:225)[camel-core-2.10.0.jar:2.10.0]
>>
>>>>
>>>> at
>>>>
>> org.apache.camel.component.bean.BeanInfo.createInvocation(BeanInfo.java:162)[camel-core-2.10.0.jar:2.10.0]
>>
>>>>
>>>> at
>>>>
>> org.apache.camel.component.bean.BeanProcessor.process(BeanProcessor.java:149)[camel-core-2.10.0.jar:2.10.0]
>>
>>>>
>>>> at
>>>>
>> org.apache.camel.util.AsyncProcessorHelper.process(AsyncProcessorHelper.java:99)[camel-core-2.10.0.jar:2.10.0]
>>
>>>>
>>>> at
>>>>
>> org.apache.camel.component.bean.BeanProcessor.process(BeanProcessor.java:73)[camel-core-2.10.0.jar:2.10.0]
>>
>>>>
>>>> at
>>>>
>> org.apache.camel.impl.ProcessorEndpoint.onExchange(ProcessorEndpoint.java:101)[camel-core-2.10.0.jar:2.10.0]
>>
>>>>
>>>> at
>>>>
>> org.apache.camel.impl.ProcessorEndpoint$1.process(ProcessorEndpoint.java:71)[camel-core-2.10.0.jar:2.10.0]
>>
>>>>
>>>> at
>>>>
>> org.apache.camel.util.AsyncProcessorConverterHelper$ProcessorToAsyncProcessorBridge.process(AsyncProcessorConverterHelper.java:61)[camel-core-2.10.0.jar:2.10.0]
>>
>>>>
>>>> at
>>>>
>> org.apache.camel.util.AsyncProcessorHelper.process(AsyncProcessorHelper.java:73)[camel-core-2.10.0.jar:2.10.0]
>>
>>>>
>>>> at
>>>>
>> org.apache.camel.processor.SendProcessor$2.doInAsyncProducer(SendProcessor.java:120)[camel-core-2.10.0.jar:2.10.0]
>>
>>>>
>>>> at
>>>>
>> org.apache.camel.impl.ProducerCache.doInAsyncProducer(ProducerCache.java:292)[camel-core-2.10.0.jar:2.10.0]
>>
>>>>
>>>> at
>>>>
>> org.apache.camel.processor.SendProcessor.process(SendProcessor.java:115)[camel-core-2.10.0.jar:2.10.0]
>>
>>>>
>>>> at
>>>>
>> org.apache.camel.util.AsyncProcessorHelper.process(AsyncProcessorHelper.java:73)[camel-core-2.10.0.jar:2.10.0]
>>
>>>>
>>>> at
>>>>
>> org.apache.camel.processor.DelegateAsyncProcessor.processNext(DelegateAsyncProcessor.java:99)[camel-core-2.10.0.jar:2.10.0]
>>
>>>>
>>>> at
>>>>
>> org.apache.camel.processor.DelegateAsyncProcessor.process(DelegateAsyncProcessor.java:90)[camel-core-2.10.0.jar:2.10.0]
>>
>>>>
>>>> at
>>>>
>> org.apache.camel.management.InstrumentationProcessor.process(InstrumentationProcessor.java:73)[camel-core-2.10.0.jar:2.10.0]
>>
>>>>
>>>> at
>>>>
>> org.apache.camel.util.AsyncProcessorHelper.process(AsyncProcessorHelper.java:73)[camel-core-2.10.0.jar:2.10.0]
>>
>>>>
>>>> at
>>>>
>> org.apache.camel.processor.DelegateAsyncProcessor.processNext(DelegateAsyncProcessor.java:99)[camel-core-2.10.0.jar:2.10.0]
>>
>>>>
>>>> at
>>>>
>> org.apache.camel.processor.DelegateAsyncProcessor.process(DelegateAsyncProcessor.java:90)[camel-core-2.10.0.jar:2.10.0]
>>
>>>>
>>>> at
>>>>
>> org.apache.camel.processor.interceptor.TraceInterceptor.process(TraceInterceptor.java:91)[camel-core-2.10.0.jar:2.10.0]
>>
>>>>
>>>> at
>>>>
>> org.apache.camel.util.AsyncProcessorHelper.process(AsyncProcessorHelper.java:73)[camel-core-2.10.0.jar:2.10.0]
>>
>>>>
>>>> at
>>>>
>> org.apache.camel.processor.RedeliveryErrorHandler.processErrorHandler(RedeliveryErrorHandler.java:330)[camel-core-2.10.0.jar:2.10.0]
>>
>>>>
>>>> at
>>>>
>> org.apache.camel.processor.RedeliveryErrorHandler.process(RedeliveryErrorHandler.java:220)[camel-core-2.10.0.jar:2.10.0]
>>
>>>>
>>>> at
>>>>
>> org.apache.camel.processor.RouteContextProcessor.processNext(RouteContextProcessor.java:45)[camel-core-2.10.0.jar:2.10.0]
>>
>>>>
>>>> at
>>>>
>> org.apache.camel.processor.DelegateAsyncProcessor.process(DelegateAsyncProcessor.java:90)[camel-core-2.10.0.jar:2.10.0]
>>
>>>>
>>>> at
>>>>
>> org.apache.camel.processor.interceptor.DefaultChannel.process(DefaultChannel.java:303)[camel-core-2.10.0.jar:2.10.0]
>>
>>>>
>>>> at
>>>>
>> org.apache.camel.util.AsyncProcessorHelper.process(AsyncProcessorHelper.java:73)[camel-core-2.10.0.jar:2.10.0]
>>
>>>>
>>>> at
>>>>
>> org.apache.camel.processor.Pipeline.process(Pipeline.java:117)[camel-core-2.10.0.jar:2.10.0]
>>
>>>>
>>>> at
>>>>
>> org.apache.camel.processor.Pipeline.process(Pipeline.java:80)[camel-core-2.10.0.jar:2.10.0]
>>
>>>>
>>>> at
>>>>
>> org.apache.camel.processor.RouteContextProcessor.processNext(RouteContextProcessor.java:45)[camel-core-2.10.0.jar:2.10.0]
>>
>>>>
>>>> at
>>>>
>> org.apache.camel.processor.DelegateAsyncProcessor.process(DelegateAsyncProcessor.java:90)[camel-core-2.10.0.jar:2.10.0]
>>
>>>>
>>>> at
>>>>
>> org.apache.camel.processor.UnitOfWorkProcessor.processAsync(UnitOfWorkProcessor.java:150)[camel-core-2.10.0.jar:2.10.0]
>>
>>>>
>>>> at
>>>>
>> org.apache.camel.processor.UnitOfWorkProcessor.process(UnitOfWorkProcessor.java:117)[camel-core-2.10.0.jar:2.10.0]
>>
>>>>
>>>> at
>>>>
>> org.apache.camel.processor.RouteInflightRepositoryProcessor.processNext(RouteInflightRepositoryProcessor.java:48)[camel-core-2.10.0.jar:2.10.0]
>>
>>>>
>>>> at
>>>>
>> org.apache.camel.processor.DelegateAsyncProcessor.process(DelegateAsyncProcessor.java:90)[camel-core-2.10.0.jar:2.10.0]
>>
>>>>
>>>> at
>>>>
>> org.apache.camel.util.AsyncProcessorHelper.process(AsyncProcessorHelper.java:73)[camel-core-2.10.0.jar:2.10.0]
>>
>>>>
>>>> at
>>>>
>> org.apache.camel.processor.DelegateAsyncProcessor.processNext(DelegateAsyncProcessor.java:99)[camel-core-2.10.0.jar:2.10.0]
>>
>>>>
>>>> at
>>>>
>> org.apache.camel.processor.DelegateAsyncProcessor.process(DelegateAsyncProcessor.java:90)[camel-core-2.10.0.jar:2.10.0]
>>
>>>>
>>>> at
>>>>
>> org.apache.camel.management.InstrumentationProcessor.process(InstrumentationProcessor.java:73)[camel-core-2.10.0.jar:2.10.0]
>>
>>>>
>>>> at
>>>>
>> org.apache.camel.util.AsyncProcessorHelper.process(AsyncProcessorHelper.java:99)[camel-core-2.10.0.jar:2.10.0]
>>
>>>>
>>>> at
>>>>
>> org.apache.camel.processor.DelegateAsyncProcessor.process(DelegateAsyncProcessor.java:86)[camel-core-2.10.0.jar:2.10.0]
>>
>>>>
>>>> at
>>>>
>> org.apache.camel.component.cxf.jaxrs.CxfRsInvoker.syncInvoke(CxfRsInvoker.java:122)[camel-cxf-2.10.0.jar:2.10.0]
>>
>>>>
>>>> at
>>>>
>> org.apache.camel.component.cxf.jaxrs.CxfRsInvoker.performInvocation(CxfRsInvoker.java:60)[camel-cxf-2.10.0.jar:2.10.0]
>>
>>>>
>>>> at
>>>>
>> org.apache.cxf.service.invoker.AbstractInvoker.invoke(AbstractInvoker.java:96)[cxf-api-2.6.1.jar:2.6.1]
>>
>>>>
>>>> at
>>>>
>> org.apache.cxf.jaxrs.JAXRSInvoker.invoke(JAXRSInvoker.java:167)[cxf-rt-frontend-jaxrs-2.6.1.jar:2.6.1]
>>
>>>>
>>>> at
>>>>
>> org.apache.cxf.jaxrs.JAXRSInvoker.invoke(JAXRSInvoker.java:94)[cxf-rt-frontend-jaxrs-2.6.1.jar:2.6.1]
>>
>>>>
>>>> at
>>>>
>> org.apache.cxf.interceptor.ServiceInvokerInterceptor$1.run(ServiceInvokerInterceptor.java:58)[cxf-api-2.6.1.jar:2.6.1]
>>
>>>>
>>>> at
>>>>
>> org.apache.cxf.interceptor.ServiceInvokerInterceptor.handleMessage(ServiceInvokerInterceptor.java:94)[cxf-api-2.6.1.jar:2.6.1]
>>
>>>>
>>>> at
>>>>
>> org.apache.cxf.phase.PhaseInterceptorChain.doIntercept(PhaseInterceptorChain.java:262)[cxf-api-2.6.1.jar:2.6.1]
>>
>>>>
>>>> at
>>>>
>> org.apache.cxf.transport.ChainInitiationObserver.onMessage(ChainInitiationObserver.java:122)[cxf-api-2.6.1.jar:2.6.1]
>>
>>>>
>>>> at
>>>>
>> org.apache.cxf.transport.http.AbstractHTTPDestination.invoke(AbstractHTTPDestination.java:211)[cxf-rt-transports-http-2.6.1.jar:2.6.1]
>>
>>>>
>>>> at
>>>>
>> org.apache.cxf.transport.servlet.ServletController.invokeDestination(ServletController.java:213)[cxf-rt-transports-http-2.6.1.jar:2.6.1]
>>
>>>>
>>>> at
>>>>
>> org.apache.cxf.transport.servlet.ServletController.invoke(ServletController.java:154)[cxf-rt-transports-http-2.6.1.jar:2.6.1]
>>
>>>>
>>>> at
>>>>
>> org.apache.cxf.transport.servlet.CXFNonSpringServlet.invoke(CXFNonSpringServlet.java:129)[cxf-rt-transports-http-2.6.1.jar:2.6.1]
>>
>>>>
>>>> at
>>>>
>> org.apache.cxf.transport.servlet.AbstractHTTPServlet.handleRequest(AbstractHTTPServlet.java:187)[cxf-rt-transports-http-2.6.1.jar:2.6.1]
>>
>>>>
>>>> at
>>>>
>> org.apache.cxf.transport.servlet.AbstractHTTPServlet.doGet(AbstractHTTPServlet.java:115)[cxf-rt-transports-http-2.6.1.jar:2.6.1]
>>
>>>>
>>>> at
>>>>
>> javax.servlet.http.HttpServlet.service(HttpServlet.java:617)[servlet-api-6.0.29.jar:]
>>
>>>>
>>>> at
>>>>
>> org.apache.cxf.transport.servlet.AbstractHTTPServlet.service(AbstractHTTPServlet.java:166)[cxf-rt-transports-http-2.6.1.jar:2.6.1]
>>
>>>>
>>>> at
>>>>
>> org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)[catalina-6.0.29.jar:6.0.29]
>>
>>>>
>>>> at
>>>>
>> org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)[catalina-6.0.29.jar:6.0.29]
>>
>>>>
>>>> at
>>>>
>> org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:233)[catalina-6.0.29.jar:6.0.29]
>>
>>>>
>>>> at
>>>>
>> org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:191)[catalina-6.0.29.jar:6.0.29]
>>
>>>>
>>>> at
>>>>
>> org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:127)[catalina-6.0.29.jar:6.0.29]
>>
>>>>
>>>> at
>>>>
>> org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)[catalina-6.0.29.jar:6.0.29]
>>
>>>>
>>>> at
>>>>
>> org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)[catalina-6.0.29.jar:6.0.29]
>>
>>>>
>>>> at
>>>>
>> org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:298)[catalina-6.0.29.jar:6.0.29]
>>
>>>>
>>>> at
>>>>
>> org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:857)[coyote-6.0.29.jar:6.0.29]
>>
>>>>
>>>> at
>>>>
>> org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:588)[coyote-6.0.29.jar:6.0.29]
>>
>>>>
>>>> at
>>>>
>> org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:489)[coyote-6.0.29.jar:6.0.29]
>>
>>>>
>>>>
>>>> Attached relevant files.
>>>>
>>>> Any help appreciated.
>>>>
>>>> Regards,
>>>> /Dumitru
>>>>
>>>>
>>>>
>>>>
>>>> --
>>>> View this message in context:
>>>>
>> http://camel.465427.n5.nabble.com/CxfRsProducer-is-not-thread-safe-tp5716351p5716712.html
>>>>
>>>> Sent from the Camel - Users mailing list archive at Nabble.com.
>>>
>>
>>
>> ------------------------------
>>   If you reply to this email, your message will be added to the discussion
>> below:
>>
>> http://camel.465427.n5.nabble.com/CxfRsProducer-is-not-thread-safe-tp5716351p5716752.html
>>   To unsubscribe from CxfRsProducer is not thread safe, click here<http://camel.465427.n5.nabble.com/template/NamlServlet.jtp?macro=unsubscribe_by_code&node=5716351&code=ZHVtaXRydS5wYXNjdUBnbWFpbC5jb218NTcxNjM1MXwtMTk2Nzc0NjQwNQ==>
>> .
>> NAML<http://camel.465427.n5.nabble.com/template/NamlServlet.jtp?macro=macro_viewer&id=instant_html%21nabble%3Aemail.naml&base=nabble.naml.namespaces.BasicNamespace-nabble.view.web.template.NabbleNamespace-nabble.view.web.template.NodeNamespace&breadcrumbs=notify_subscribers%21nabble%3Aemail.naml-instant_emails%21nabble%3Aemail.naml-send_instant_email%21nabble%3Aemail.naml>
>>
>
>
>
>
> --
> View this message in context: http://camel.465427.n5.nabble.com/CxfRsProducer-is-not-thread-safe-tp5716351p5716836.html
> Sent from the Camel - Users mailing list archive at Nabble.com.

Re: CxfRsProducer is not thread safe

Posted by dumi_p <du...@gmail.com>.
Thank you, that did it: added cglib and operation name for the bean route.

Although for the moment it works, I don't necessarily like adding the
method name in the route, as I would have preferred to have the proxy more
generic - for all methods exposed by the webservice in the backend.

I ran the test you've send me and surprisingly it does not fail although it
seems almost identical to my case. I will look more into it tomorrow.

Best regards,
/Dumitru

On Fri, Aug 3, 2012 at 10:42 AM, Sergey Beryozkin-3 [via Camel] <
ml-node+s465427n5716752h33@n5.nabble.com> wrote:

> On 03/08/12 10:26, Sergey Beryozkin wrote:
>
> > Hi
> > On 02/08/12 23:42, dumi_p wrote:
> >> Hi,
> >>
> >> In the mean time, I tried to use jaxrs:client, but got into another
> >> problem. Seems like<jaxrs:client> accepts only interfaces for the
> >> serviceClass attribute, so I created a new interface
> >
> > it can create proxies from concrete classes, but it needs a cglib-nodep
> > for it to work.
> >
> >> (CustomerServiceInterface) and configured it as it follows:
> >> <jaxrs:client id="rsClient"
> >> address="
> http://localhost:8080/camel-example-cxf-tomcat/webservices/rest"
> >>
> serviceClass="org.apache.camel.example.cxf.restobjects.CustomerServiceInterface"
>
> >>
> >> inheritHeaders="true">
> >> <jaxrs:headers>
> >> <entry key="Accept" value="text/xml" />
> >> </jaxrs:headers>
> >> </jaxrs:client>
> >>
> >
> > add a 'threadSafe' flag please
> >
> >> Route is:
> >> from("cxfrs:bean:rsServer")
> >> .to("log:input")
> >> .to("bean:rsClient")
> >> .to("log:output");
> >>
> >> Error I get is:
> >
> > I think the exception below suggests a camel bean component can not
> > invoke on proxies.
> >
>
> Actually, it seems more to do with the misconfiguration, according to
> http://camel.apache.org/bean.html
>
> one needs to specify a 'method' parameter
>
> Try it please
> Sergey
>
> > Cheers, Sergey
> >
> > P.S. Btw, if you can get a chance, please try a test code I attached to
> > JIRA. I do not dispute the fact you saw the thread-safety related
> > exception but I need to create a failing test to start with :-) and the
> > test I did mimics the way your route works very closely
> >
> >> 2012-08-02 23:31:20,894 [http-8080-1 ] ERROR DefaultErrorHandler
> >> - Failed delivery for (MessageId: ID-Dumi-PC-57364-1343939398047-0-1 on
> >> ExchangeId: ID-Dumi-PC-57364-1343939398047-0-2). Exhausted after
> delivery
> >> attempt: 1 caught:
> >> org.apache.camel.component.bean.AmbiguousMethodCallException: Ambiguous
> >> method invocations possible: [public final
> >> org.apache.camel.example.cxf.restobjects.Customer
> >> $Proxy49.getCustomer(java.lang.String), public final
> >> org.apache.camel.example.cxf.restobjects.Customer
> >> $Proxy49.getCustomer(java.lang.String)]. Exchange[Message: 123]
> >> org.apache.camel.component.bean.AmbiguousMethodCallException: Ambiguous
> >> method invocations possible: [public final
> >> org.apache.camel.example.cxf.restobjects.Customer
> >> $Proxy49.getCustomer(java.lang.String), public final
> >> org.apache.camel.example.cxf.restobjects.Customer
> >> $Proxy49.getCustomer(java.lang.String)]. Exchange[Message: 123]
> >> at
> >>
> org.apache.camel.component.bean.BeanInfo.chooseBestPossibleMethodInfo(BeanInfo.java:587)[camel-core-2.10.0.jar:2.10.0]
>
> >>
> >> at
> >>
> org.apache.camel.component.bean.BeanInfo.chooseMethodWithMatchingBody(BeanInfo.java:544)[camel-core-2.10.0.jar:2.10.0]
>
> >>
> >> at
> >>
> org.apache.camel.component.bean.BeanInfo.chooseMethod(BeanInfo.java:496)[camel-core-2.10.0.jar:2.10.0]
>
> >>
> >> at
> >>
> org.apache.camel.component.bean.BeanInfo.createInvocation(BeanInfo.java:225)[camel-core-2.10.0.jar:2.10.0]
>
> >>
> >> at
> >>
> org.apache.camel.component.bean.BeanInfo.createInvocation(BeanInfo.java:162)[camel-core-2.10.0.jar:2.10.0]
>
> >>
> >> at
> >>
> org.apache.camel.component.bean.BeanProcessor.process(BeanProcessor.java:149)[camel-core-2.10.0.jar:2.10.0]
>
> >>
> >> at
> >>
> org.apache.camel.util.AsyncProcessorHelper.process(AsyncProcessorHelper.java:99)[camel-core-2.10.0.jar:2.10.0]
>
> >>
> >> at
> >>
> org.apache.camel.component.bean.BeanProcessor.process(BeanProcessor.java:73)[camel-core-2.10.0.jar:2.10.0]
>
> >>
> >> at
> >>
> org.apache.camel.impl.ProcessorEndpoint.onExchange(ProcessorEndpoint.java:101)[camel-core-2.10.0.jar:2.10.0]
>
> >>
> >> at
> >>
> org.apache.camel.impl.ProcessorEndpoint$1.process(ProcessorEndpoint.java:71)[camel-core-2.10.0.jar:2.10.0]
>
> >>
> >> at
> >>
> org.apache.camel.util.AsyncProcessorConverterHelper$ProcessorToAsyncProcessorBridge.process(AsyncProcessorConverterHelper.java:61)[camel-core-2.10.0.jar:2.10.0]
>
> >>
> >> at
> >>
> org.apache.camel.util.AsyncProcessorHelper.process(AsyncProcessorHelper.java:73)[camel-core-2.10.0.jar:2.10.0]
>
> >>
> >> at
> >>
> org.apache.camel.processor.SendProcessor$2.doInAsyncProducer(SendProcessor.java:120)[camel-core-2.10.0.jar:2.10.0]
>
> >>
> >> at
> >>
> org.apache.camel.impl.ProducerCache.doInAsyncProducer(ProducerCache.java:292)[camel-core-2.10.0.jar:2.10.0]
>
> >>
> >> at
> >>
> org.apache.camel.processor.SendProcessor.process(SendProcessor.java:115)[camel-core-2.10.0.jar:2.10.0]
>
> >>
> >> at
> >>
> org.apache.camel.util.AsyncProcessorHelper.process(AsyncProcessorHelper.java:73)[camel-core-2.10.0.jar:2.10.0]
>
> >>
> >> at
> >>
> org.apache.camel.processor.DelegateAsyncProcessor.processNext(DelegateAsyncProcessor.java:99)[camel-core-2.10.0.jar:2.10.0]
>
> >>
> >> at
> >>
> org.apache.camel.processor.DelegateAsyncProcessor.process(DelegateAsyncProcessor.java:90)[camel-core-2.10.0.jar:2.10.0]
>
> >>
> >> at
> >>
> org.apache.camel.management.InstrumentationProcessor.process(InstrumentationProcessor.java:73)[camel-core-2.10.0.jar:2.10.0]
>
> >>
> >> at
> >>
> org.apache.camel.util.AsyncProcessorHelper.process(AsyncProcessorHelper.java:73)[camel-core-2.10.0.jar:2.10.0]
>
> >>
> >> at
> >>
> org.apache.camel.processor.DelegateAsyncProcessor.processNext(DelegateAsyncProcessor.java:99)[camel-core-2.10.0.jar:2.10.0]
>
> >>
> >> at
> >>
> org.apache.camel.processor.DelegateAsyncProcessor.process(DelegateAsyncProcessor.java:90)[camel-core-2.10.0.jar:2.10.0]
>
> >>
> >> at
> >>
> org.apache.camel.processor.interceptor.TraceInterceptor.process(TraceInterceptor.java:91)[camel-core-2.10.0.jar:2.10.0]
>
> >>
> >> at
> >>
> org.apache.camel.util.AsyncProcessorHelper.process(AsyncProcessorHelper.java:73)[camel-core-2.10.0.jar:2.10.0]
>
> >>
> >> at
> >>
> org.apache.camel.processor.RedeliveryErrorHandler.processErrorHandler(RedeliveryErrorHandler.java:330)[camel-core-2.10.0.jar:2.10.0]
>
> >>
> >> at
> >>
> org.apache.camel.processor.RedeliveryErrorHandler.process(RedeliveryErrorHandler.java:220)[camel-core-2.10.0.jar:2.10.0]
>
> >>
> >> at
> >>
> org.apache.camel.processor.RouteContextProcessor.processNext(RouteContextProcessor.java:45)[camel-core-2.10.0.jar:2.10.0]
>
> >>
> >> at
> >>
> org.apache.camel.processor.DelegateAsyncProcessor.process(DelegateAsyncProcessor.java:90)[camel-core-2.10.0.jar:2.10.0]
>
> >>
> >> at
> >>
> org.apache.camel.processor.interceptor.DefaultChannel.process(DefaultChannel.java:303)[camel-core-2.10.0.jar:2.10.0]
>
> >>
> >> at
> >>
> org.apache.camel.util.AsyncProcessorHelper.process(AsyncProcessorHelper.java:73)[camel-core-2.10.0.jar:2.10.0]
>
> >>
> >> at
> >>
> org.apache.camel.processor.Pipeline.process(Pipeline.java:117)[camel-core-2.10.0.jar:2.10.0]
>
> >>
> >> at
> >>
> org.apache.camel.processor.Pipeline.process(Pipeline.java:80)[camel-core-2.10.0.jar:2.10.0]
>
> >>
> >> at
> >>
> org.apache.camel.processor.RouteContextProcessor.processNext(RouteContextProcessor.java:45)[camel-core-2.10.0.jar:2.10.0]
>
> >>
> >> at
> >>
> org.apache.camel.processor.DelegateAsyncProcessor.process(DelegateAsyncProcessor.java:90)[camel-core-2.10.0.jar:2.10.0]
>
> >>
> >> at
> >>
> org.apache.camel.processor.UnitOfWorkProcessor.processAsync(UnitOfWorkProcessor.java:150)[camel-core-2.10.0.jar:2.10.0]
>
> >>
> >> at
> >>
> org.apache.camel.processor.UnitOfWorkProcessor.process(UnitOfWorkProcessor.java:117)[camel-core-2.10.0.jar:2.10.0]
>
> >>
> >> at
> >>
> org.apache.camel.processor.RouteInflightRepositoryProcessor.processNext(RouteInflightRepositoryProcessor.java:48)[camel-core-2.10.0.jar:2.10.0]
>
> >>
> >> at
> >>
> org.apache.camel.processor.DelegateAsyncProcessor.process(DelegateAsyncProcessor.java:90)[camel-core-2.10.0.jar:2.10.0]
>
> >>
> >> at
> >>
> org.apache.camel.util.AsyncProcessorHelper.process(AsyncProcessorHelper.java:73)[camel-core-2.10.0.jar:2.10.0]
>
> >>
> >> at
> >>
> org.apache.camel.processor.DelegateAsyncProcessor.processNext(DelegateAsyncProcessor.java:99)[camel-core-2.10.0.jar:2.10.0]
>
> >>
> >> at
> >>
> org.apache.camel.processor.DelegateAsyncProcessor.process(DelegateAsyncProcessor.java:90)[camel-core-2.10.0.jar:2.10.0]
>
> >>
> >> at
> >>
> org.apache.camel.management.InstrumentationProcessor.process(InstrumentationProcessor.java:73)[camel-core-2.10.0.jar:2.10.0]
>
> >>
> >> at
> >>
> org.apache.camel.util.AsyncProcessorHelper.process(AsyncProcessorHelper.java:99)[camel-core-2.10.0.jar:2.10.0]
>
> >>
> >> at
> >>
> org.apache.camel.processor.DelegateAsyncProcessor.process(DelegateAsyncProcessor.java:86)[camel-core-2.10.0.jar:2.10.0]
>
> >>
> >> at
> >>
> org.apache.camel.component.cxf.jaxrs.CxfRsInvoker.syncInvoke(CxfRsInvoker.java:122)[camel-cxf-2.10.0.jar:2.10.0]
>
> >>
> >> at
> >>
> org.apache.camel.component.cxf.jaxrs.CxfRsInvoker.performInvocation(CxfRsInvoker.java:60)[camel-cxf-2.10.0.jar:2.10.0]
>
> >>
> >> at
> >>
> org.apache.cxf.service.invoker.AbstractInvoker.invoke(AbstractInvoker.java:96)[cxf-api-2.6.1.jar:2.6.1]
>
> >>
> >> at
> >>
> org.apache.cxf.jaxrs.JAXRSInvoker.invoke(JAXRSInvoker.java:167)[cxf-rt-frontend-jaxrs-2.6.1.jar:2.6.1]
>
> >>
> >> at
> >>
> org.apache.cxf.jaxrs.JAXRSInvoker.invoke(JAXRSInvoker.java:94)[cxf-rt-frontend-jaxrs-2.6.1.jar:2.6.1]
>
> >>
> >> at
> >>
> org.apache.cxf.interceptor.ServiceInvokerInterceptor$1.run(ServiceInvokerInterceptor.java:58)[cxf-api-2.6.1.jar:2.6.1]
>
> >>
> >> at
> >>
> org.apache.cxf.interceptor.ServiceInvokerInterceptor.handleMessage(ServiceInvokerInterceptor.java:94)[cxf-api-2.6.1.jar:2.6.1]
>
> >>
> >> at
> >>
> org.apache.cxf.phase.PhaseInterceptorChain.doIntercept(PhaseInterceptorChain.java:262)[cxf-api-2.6.1.jar:2.6.1]
>
> >>
> >> at
> >>
> org.apache.cxf.transport.ChainInitiationObserver.onMessage(ChainInitiationObserver.java:122)[cxf-api-2.6.1.jar:2.6.1]
>
> >>
> >> at
> >>
> org.apache.cxf.transport.http.AbstractHTTPDestination.invoke(AbstractHTTPDestination.java:211)[cxf-rt-transports-http-2.6.1.jar:2.6.1]
>
> >>
> >> at
> >>
> org.apache.cxf.transport.servlet.ServletController.invokeDestination(ServletController.java:213)[cxf-rt-transports-http-2.6.1.jar:2.6.1]
>
> >>
> >> at
> >>
> org.apache.cxf.transport.servlet.ServletController.invoke(ServletController.java:154)[cxf-rt-transports-http-2.6.1.jar:2.6.1]
>
> >>
> >> at
> >>
> org.apache.cxf.transport.servlet.CXFNonSpringServlet.invoke(CXFNonSpringServlet.java:129)[cxf-rt-transports-http-2.6.1.jar:2.6.1]
>
> >>
> >> at
> >>
> org.apache.cxf.transport.servlet.AbstractHTTPServlet.handleRequest(AbstractHTTPServlet.java:187)[cxf-rt-transports-http-2.6.1.jar:2.6.1]
>
> >>
> >> at
> >>
> org.apache.cxf.transport.servlet.AbstractHTTPServlet.doGet(AbstractHTTPServlet.java:115)[cxf-rt-transports-http-2.6.1.jar:2.6.1]
>
> >>
> >> at
> >>
> javax.servlet.http.HttpServlet.service(HttpServlet.java:617)[servlet-api-6.0.29.jar:]
>
> >>
> >> at
> >>
> org.apache.cxf.transport.servlet.AbstractHTTPServlet.service(AbstractHTTPServlet.java:166)[cxf-rt-transports-http-2.6.1.jar:2.6.1]
>
> >>
> >> at
> >>
> org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)[catalina-6.0.29.jar:6.0.29]
>
> >>
> >> at
> >>
> org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)[catalina-6.0.29.jar:6.0.29]
>
> >>
> >> at
> >>
> org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:233)[catalina-6.0.29.jar:6.0.29]
>
> >>
> >> at
> >>
> org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:191)[catalina-6.0.29.jar:6.0.29]
>
> >>
> >> at
> >>
> org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:127)[catalina-6.0.29.jar:6.0.29]
>
> >>
> >> at
> >>
> org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)[catalina-6.0.29.jar:6.0.29]
>
> >>
> >> at
> >>
> org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)[catalina-6.0.29.jar:6.0.29]
>
> >>
> >> at
> >>
> org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:298)[catalina-6.0.29.jar:6.0.29]
>
> >>
> >> at
> >>
> org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:857)[coyote-6.0.29.jar:6.0.29]
>
> >>
> >> at
> >>
> org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:588)[coyote-6.0.29.jar:6.0.29]
>
> >>
> >> at
> >>
> org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:489)[coyote-6.0.29.jar:6.0.29]
>
> >>
> >>
> >> Attached relevant files.
> >>
> >> Any help appreciated.
> >>
> >> Regards,
> >> /Dumitru
> >>
> >>
> >>
> >>
> >> --
> >> View this message in context:
> >>
> http://camel.465427.n5.nabble.com/CxfRsProducer-is-not-thread-safe-tp5716351p5716712.html
> >>
> >> Sent from the Camel - Users mailing list archive at Nabble.com.
> >
>
>
> ------------------------------
>  If you reply to this email, your message will be added to the discussion
> below:
>
> http://camel.465427.n5.nabble.com/CxfRsProducer-is-not-thread-safe-tp5716351p5716752.html
>  To unsubscribe from CxfRsProducer is not thread safe, click here<http://camel.465427.n5.nabble.com/template/NamlServlet.jtp?macro=unsubscribe_by_code&node=5716351&code=ZHVtaXRydS5wYXNjdUBnbWFpbC5jb218NTcxNjM1MXwtMTk2Nzc0NjQwNQ==>
> .
> NAML<http://camel.465427.n5.nabble.com/template/NamlServlet.jtp?macro=macro_viewer&id=instant_html%21nabble%3Aemail.naml&base=nabble.naml.namespaces.BasicNamespace-nabble.view.web.template.NabbleNamespace-nabble.view.web.template.NodeNamespace&breadcrumbs=notify_subscribers%21nabble%3Aemail.naml-instant_emails%21nabble%3Aemail.naml-send_instant_email%21nabble%3Aemail.naml>
>




--
View this message in context: http://camel.465427.n5.nabble.com/CxfRsProducer-is-not-thread-safe-tp5716351p5716836.html
Sent from the Camel - Users mailing list archive at Nabble.com.

Re: CxfRsProducer is not thread safe

Posted by Sergey Beryozkin <sb...@gmail.com>.
On 03/08/12 10:26, Sergey Beryozkin wrote:
> Hi
> On 02/08/12 23:42, dumi_p wrote:
>> Hi,
>>
>> In the mean time, I tried to use jaxrs:client, but got into another
>> problem. Seems like<jaxrs:client> accepts only interfaces for the
>> serviceClass attribute, so I created a new interface
>
> it can create proxies from concrete classes, but it needs a cglib-nodep
> for it to work.
>
>> (CustomerServiceInterface) and configured it as it follows:
>> <jaxrs:client id="rsClient"
>> address="http://localhost:8080/camel-example-cxf-tomcat/webservices/rest"
>> serviceClass="org.apache.camel.example.cxf.restobjects.CustomerServiceInterface"
>>
>> inheritHeaders="true">
>> <jaxrs:headers>
>> <entry key="Accept" value="text/xml" />
>> </jaxrs:headers>
>> </jaxrs:client>
>>
>
> add a 'threadSafe' flag please
>
>> Route is:
>> from("cxfrs:bean:rsServer")
>> .to("log:input")
>> .to("bean:rsClient")
>> .to("log:output");
>>
>> Error I get is:
>
> I think the exception below suggests a camel bean component can not
> invoke on proxies.
>

Actually, it seems more to do with the misconfiguration, according to
http://camel.apache.org/bean.html

one needs to specify a 'method' parameter

Try it please
Sergey

> Cheers, Sergey
>
> P.S. Btw, if you can get a chance, please try a test code I attached to
> JIRA. I do not dispute the fact you saw the thread-safety related
> exception but I need to create a failing test to start with :-) and the
> test I did mimics the way your route works very closely
>
>> 2012-08-02 23:31:20,894 [http-8080-1 ] ERROR DefaultErrorHandler
>> - Failed delivery for (MessageId: ID-Dumi-PC-57364-1343939398047-0-1 on
>> ExchangeId: ID-Dumi-PC-57364-1343939398047-0-2). Exhausted after delivery
>> attempt: 1 caught:
>> org.apache.camel.component.bean.AmbiguousMethodCallException: Ambiguous
>> method invocations possible: [public final
>> org.apache.camel.example.cxf.restobjects.Customer
>> $Proxy49.getCustomer(java.lang.String), public final
>> org.apache.camel.example.cxf.restobjects.Customer
>> $Proxy49.getCustomer(java.lang.String)]. Exchange[Message: 123]
>> org.apache.camel.component.bean.AmbiguousMethodCallException: Ambiguous
>> method invocations possible: [public final
>> org.apache.camel.example.cxf.restobjects.Customer
>> $Proxy49.getCustomer(java.lang.String), public final
>> org.apache.camel.example.cxf.restobjects.Customer
>> $Proxy49.getCustomer(java.lang.String)]. Exchange[Message: 123]
>> at
>> org.apache.camel.component.bean.BeanInfo.chooseBestPossibleMethodInfo(BeanInfo.java:587)[camel-core-2.10.0.jar:2.10.0]
>>
>> at
>> org.apache.camel.component.bean.BeanInfo.chooseMethodWithMatchingBody(BeanInfo.java:544)[camel-core-2.10.0.jar:2.10.0]
>>
>> at
>> org.apache.camel.component.bean.BeanInfo.chooseMethod(BeanInfo.java:496)[camel-core-2.10.0.jar:2.10.0]
>>
>> at
>> org.apache.camel.component.bean.BeanInfo.createInvocation(BeanInfo.java:225)[camel-core-2.10.0.jar:2.10.0]
>>
>> at
>> org.apache.camel.component.bean.BeanInfo.createInvocation(BeanInfo.java:162)[camel-core-2.10.0.jar:2.10.0]
>>
>> at
>> org.apache.camel.component.bean.BeanProcessor.process(BeanProcessor.java:149)[camel-core-2.10.0.jar:2.10.0]
>>
>> at
>> org.apache.camel.util.AsyncProcessorHelper.process(AsyncProcessorHelper.java:99)[camel-core-2.10.0.jar:2.10.0]
>>
>> at
>> org.apache.camel.component.bean.BeanProcessor.process(BeanProcessor.java:73)[camel-core-2.10.0.jar:2.10.0]
>>
>> at
>> org.apache.camel.impl.ProcessorEndpoint.onExchange(ProcessorEndpoint.java:101)[camel-core-2.10.0.jar:2.10.0]
>>
>> at
>> org.apache.camel.impl.ProcessorEndpoint$1.process(ProcessorEndpoint.java:71)[camel-core-2.10.0.jar:2.10.0]
>>
>> at
>> org.apache.camel.util.AsyncProcessorConverterHelper$ProcessorToAsyncProcessorBridge.process(AsyncProcessorConverterHelper.java:61)[camel-core-2.10.0.jar:2.10.0]
>>
>> at
>> org.apache.camel.util.AsyncProcessorHelper.process(AsyncProcessorHelper.java:73)[camel-core-2.10.0.jar:2.10.0]
>>
>> at
>> org.apache.camel.processor.SendProcessor$2.doInAsyncProducer(SendProcessor.java:120)[camel-core-2.10.0.jar:2.10.0]
>>
>> at
>> org.apache.camel.impl.ProducerCache.doInAsyncProducer(ProducerCache.java:292)[camel-core-2.10.0.jar:2.10.0]
>>
>> at
>> org.apache.camel.processor.SendProcessor.process(SendProcessor.java:115)[camel-core-2.10.0.jar:2.10.0]
>>
>> at
>> org.apache.camel.util.AsyncProcessorHelper.process(AsyncProcessorHelper.java:73)[camel-core-2.10.0.jar:2.10.0]
>>
>> at
>> org.apache.camel.processor.DelegateAsyncProcessor.processNext(DelegateAsyncProcessor.java:99)[camel-core-2.10.0.jar:2.10.0]
>>
>> at
>> org.apache.camel.processor.DelegateAsyncProcessor.process(DelegateAsyncProcessor.java:90)[camel-core-2.10.0.jar:2.10.0]
>>
>> at
>> org.apache.camel.management.InstrumentationProcessor.process(InstrumentationProcessor.java:73)[camel-core-2.10.0.jar:2.10.0]
>>
>> at
>> org.apache.camel.util.AsyncProcessorHelper.process(AsyncProcessorHelper.java:73)[camel-core-2.10.0.jar:2.10.0]
>>
>> at
>> org.apache.camel.processor.DelegateAsyncProcessor.processNext(DelegateAsyncProcessor.java:99)[camel-core-2.10.0.jar:2.10.0]
>>
>> at
>> org.apache.camel.processor.DelegateAsyncProcessor.process(DelegateAsyncProcessor.java:90)[camel-core-2.10.0.jar:2.10.0]
>>
>> at
>> org.apache.camel.processor.interceptor.TraceInterceptor.process(TraceInterceptor.java:91)[camel-core-2.10.0.jar:2.10.0]
>>
>> at
>> org.apache.camel.util.AsyncProcessorHelper.process(AsyncProcessorHelper.java:73)[camel-core-2.10.0.jar:2.10.0]
>>
>> at
>> org.apache.camel.processor.RedeliveryErrorHandler.processErrorHandler(RedeliveryErrorHandler.java:330)[camel-core-2.10.0.jar:2.10.0]
>>
>> at
>> org.apache.camel.processor.RedeliveryErrorHandler.process(RedeliveryErrorHandler.java:220)[camel-core-2.10.0.jar:2.10.0]
>>
>> at
>> org.apache.camel.processor.RouteContextProcessor.processNext(RouteContextProcessor.java:45)[camel-core-2.10.0.jar:2.10.0]
>>
>> at
>> org.apache.camel.processor.DelegateAsyncProcessor.process(DelegateAsyncProcessor.java:90)[camel-core-2.10.0.jar:2.10.0]
>>
>> at
>> org.apache.camel.processor.interceptor.DefaultChannel.process(DefaultChannel.java:303)[camel-core-2.10.0.jar:2.10.0]
>>
>> at
>> org.apache.camel.util.AsyncProcessorHelper.process(AsyncProcessorHelper.java:73)[camel-core-2.10.0.jar:2.10.0]
>>
>> at
>> org.apache.camel.processor.Pipeline.process(Pipeline.java:117)[camel-core-2.10.0.jar:2.10.0]
>>
>> at
>> org.apache.camel.processor.Pipeline.process(Pipeline.java:80)[camel-core-2.10.0.jar:2.10.0]
>>
>> at
>> org.apache.camel.processor.RouteContextProcessor.processNext(RouteContextProcessor.java:45)[camel-core-2.10.0.jar:2.10.0]
>>
>> at
>> org.apache.camel.processor.DelegateAsyncProcessor.process(DelegateAsyncProcessor.java:90)[camel-core-2.10.0.jar:2.10.0]
>>
>> at
>> org.apache.camel.processor.UnitOfWorkProcessor.processAsync(UnitOfWorkProcessor.java:150)[camel-core-2.10.0.jar:2.10.0]
>>
>> at
>> org.apache.camel.processor.UnitOfWorkProcessor.process(UnitOfWorkProcessor.java:117)[camel-core-2.10.0.jar:2.10.0]
>>
>> at
>> org.apache.camel.processor.RouteInflightRepositoryProcessor.processNext(RouteInflightRepositoryProcessor.java:48)[camel-core-2.10.0.jar:2.10.0]
>>
>> at
>> org.apache.camel.processor.DelegateAsyncProcessor.process(DelegateAsyncProcessor.java:90)[camel-core-2.10.0.jar:2.10.0]
>>
>> at
>> org.apache.camel.util.AsyncProcessorHelper.process(AsyncProcessorHelper.java:73)[camel-core-2.10.0.jar:2.10.0]
>>
>> at
>> org.apache.camel.processor.DelegateAsyncProcessor.processNext(DelegateAsyncProcessor.java:99)[camel-core-2.10.0.jar:2.10.0]
>>
>> at
>> org.apache.camel.processor.DelegateAsyncProcessor.process(DelegateAsyncProcessor.java:90)[camel-core-2.10.0.jar:2.10.0]
>>
>> at
>> org.apache.camel.management.InstrumentationProcessor.process(InstrumentationProcessor.java:73)[camel-core-2.10.0.jar:2.10.0]
>>
>> at
>> org.apache.camel.util.AsyncProcessorHelper.process(AsyncProcessorHelper.java:99)[camel-core-2.10.0.jar:2.10.0]
>>
>> at
>> org.apache.camel.processor.DelegateAsyncProcessor.process(DelegateAsyncProcessor.java:86)[camel-core-2.10.0.jar:2.10.0]
>>
>> at
>> org.apache.camel.component.cxf.jaxrs.CxfRsInvoker.syncInvoke(CxfRsInvoker.java:122)[camel-cxf-2.10.0.jar:2.10.0]
>>
>> at
>> org.apache.camel.component.cxf.jaxrs.CxfRsInvoker.performInvocation(CxfRsInvoker.java:60)[camel-cxf-2.10.0.jar:2.10.0]
>>
>> at
>> org.apache.cxf.service.invoker.AbstractInvoker.invoke(AbstractInvoker.java:96)[cxf-api-2.6.1.jar:2.6.1]
>>
>> at
>> org.apache.cxf.jaxrs.JAXRSInvoker.invoke(JAXRSInvoker.java:167)[cxf-rt-frontend-jaxrs-2.6.1.jar:2.6.1]
>>
>> at
>> org.apache.cxf.jaxrs.JAXRSInvoker.invoke(JAXRSInvoker.java:94)[cxf-rt-frontend-jaxrs-2.6.1.jar:2.6.1]
>>
>> at
>> org.apache.cxf.interceptor.ServiceInvokerInterceptor$1.run(ServiceInvokerInterceptor.java:58)[cxf-api-2.6.1.jar:2.6.1]
>>
>> at
>> org.apache.cxf.interceptor.ServiceInvokerInterceptor.handleMessage(ServiceInvokerInterceptor.java:94)[cxf-api-2.6.1.jar:2.6.1]
>>
>> at
>> org.apache.cxf.phase.PhaseInterceptorChain.doIntercept(PhaseInterceptorChain.java:262)[cxf-api-2.6.1.jar:2.6.1]
>>
>> at
>> org.apache.cxf.transport.ChainInitiationObserver.onMessage(ChainInitiationObserver.java:122)[cxf-api-2.6.1.jar:2.6.1]
>>
>> at
>> org.apache.cxf.transport.http.AbstractHTTPDestination.invoke(AbstractHTTPDestination.java:211)[cxf-rt-transports-http-2.6.1.jar:2.6.1]
>>
>> at
>> org.apache.cxf.transport.servlet.ServletController.invokeDestination(ServletController.java:213)[cxf-rt-transports-http-2.6.1.jar:2.6.1]
>>
>> at
>> org.apache.cxf.transport.servlet.ServletController.invoke(ServletController.java:154)[cxf-rt-transports-http-2.6.1.jar:2.6.1]
>>
>> at
>> org.apache.cxf.transport.servlet.CXFNonSpringServlet.invoke(CXFNonSpringServlet.java:129)[cxf-rt-transports-http-2.6.1.jar:2.6.1]
>>
>> at
>> org.apache.cxf.transport.servlet.AbstractHTTPServlet.handleRequest(AbstractHTTPServlet.java:187)[cxf-rt-transports-http-2.6.1.jar:2.6.1]
>>
>> at
>> org.apache.cxf.transport.servlet.AbstractHTTPServlet.doGet(AbstractHTTPServlet.java:115)[cxf-rt-transports-http-2.6.1.jar:2.6.1]
>>
>> at
>> javax.servlet.http.HttpServlet.service(HttpServlet.java:617)[servlet-api-6.0.29.jar:]
>>
>> at
>> org.apache.cxf.transport.servlet.AbstractHTTPServlet.service(AbstractHTTPServlet.java:166)[cxf-rt-transports-http-2.6.1.jar:2.6.1]
>>
>> at
>> org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)[catalina-6.0.29.jar:6.0.29]
>>
>> at
>> org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)[catalina-6.0.29.jar:6.0.29]
>>
>> at
>> org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:233)[catalina-6.0.29.jar:6.0.29]
>>
>> at
>> org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:191)[catalina-6.0.29.jar:6.0.29]
>>
>> at
>> org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:127)[catalina-6.0.29.jar:6.0.29]
>>
>> at
>> org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)[catalina-6.0.29.jar:6.0.29]
>>
>> at
>> org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)[catalina-6.0.29.jar:6.0.29]
>>
>> at
>> org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:298)[catalina-6.0.29.jar:6.0.29]
>>
>> at
>> org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:857)[coyote-6.0.29.jar:6.0.29]
>>
>> at
>> org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:588)[coyote-6.0.29.jar:6.0.29]
>>
>> at
>> org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:489)[coyote-6.0.29.jar:6.0.29]
>>
>>
>> Attached relevant files.
>>
>> Any help appreciated.
>>
>> Regards,
>> /Dumitru
>>
>>
>>
>>
>> --
>> View this message in context:
>> http://camel.465427.n5.nabble.com/CxfRsProducer-is-not-thread-safe-tp5716351p5716712.html
>>
>> Sent from the Camel - Users mailing list archive at Nabble.com.
>

Re: CxfRsProducer is not thread safe

Posted by Sergey Beryozkin <sb...@gmail.com>.
Hi
On 02/08/12 23:42, dumi_p wrote:
> Hi,
>
> In the mean time, I tried to use jaxrs:client, but got into another
> problem. Seems like<jaxrs:client>  accepts only interfaces for the
> serviceClass attribute, so I created a new interface

it can create proxies from concrete classes, but it needs a cglib-nodep 
for it to work.

> (CustomerServiceInterface) and configured it as it follows:
> <jaxrs:client id="rsClient"
> address="http://localhost:8080/camel-example-cxf-tomcat/webservices/rest"
> serviceClass="org.apache.camel.example.cxf.restobjects.CustomerServiceInterface"
> inheritHeaders="true">
> <jaxrs:headers>
> <entry key="Accept" value="text/xml" />
> </jaxrs:headers>
> </jaxrs:client>
>

add a 'threadSafe' flag please

> Route is:
> from("cxfrs:bean:rsServer")
> .to("log:input")
> .to("bean:rsClient")
> .to("log:output");
>
> Error I get is:

I think the exception below suggests a camel bean component can not 
invoke on proxies.

Cheers, Sergey

P.S. Btw, if you can get a chance, please try a test code I attached to 
JIRA. I do not dispute the fact you saw the thread-safety related 
exception but I need to create a failing test to start with :-) and the 
test I did mimics the way your route works very closely

> 2012-08-02 23:31:20,894 [http-8080-1    ] ERROR DefaultErrorHandler
>     - Failed delivery for (MessageId: ID-Dumi-PC-57364-1343939398047-0-1 on
> ExchangeId: ID-Dumi-PC-57364-1343939398047-0-2). Exhausted after delivery
> attempt: 1 caught:
> org.apache.camel.component.bean.AmbiguousMethodCallException: Ambiguous
> method invocations possible: [public final
> org.apache.camel.example.cxf.restobjects.Customer
> $Proxy49.getCustomer(java.lang.String), public final
> org.apache.camel.example.cxf.restobjects.Customer
> $Proxy49.getCustomer(java.lang.String)]. Exchange[Message: 123]
> org.apache.camel.component.bean.AmbiguousMethodCallException: Ambiguous
> method invocations possible: [public final
> org.apache.camel.example.cxf.restobjects.Customer
> $Proxy49.getCustomer(java.lang.String), public final
> org.apache.camel.example.cxf.restobjects.Customer
> $Proxy49.getCustomer(java.lang.String)]. Exchange[Message: 123]
> at
> org.apache.camel.component.bean.BeanInfo.chooseBestPossibleMethodInfo(BeanInfo.java:587)[camel-core-2.10.0.jar:2.10.0]
> at
> org.apache.camel.component.bean.BeanInfo.chooseMethodWithMatchingBody(BeanInfo.java:544)[camel-core-2.10.0.jar:2.10.0]
> at
> org.apache.camel.component.bean.BeanInfo.chooseMethod(BeanInfo.java:496)[camel-core-2.10.0.jar:2.10.0]
> at
> org.apache.camel.component.bean.BeanInfo.createInvocation(BeanInfo.java:225)[camel-core-2.10.0.jar:2.10.0]
> at
> org.apache.camel.component.bean.BeanInfo.createInvocation(BeanInfo.java:162)[camel-core-2.10.0.jar:2.10.0]
> at
> org.apache.camel.component.bean.BeanProcessor.process(BeanProcessor.java:149)[camel-core-2.10.0.jar:2.10.0]
> at
> org.apache.camel.util.AsyncProcessorHelper.process(AsyncProcessorHelper.java:99)[camel-core-2.10.0.jar:2.10.0]
> at
> org.apache.camel.component.bean.BeanProcessor.process(BeanProcessor.java:73)[camel-core-2.10.0.jar:2.10.0]
> at
> org.apache.camel.impl.ProcessorEndpoint.onExchange(ProcessorEndpoint.java:101)[camel-core-2.10.0.jar:2.10.0]
> at
> org.apache.camel.impl.ProcessorEndpoint$1.process(ProcessorEndpoint.java:71)[camel-core-2.10.0.jar:2.10.0]
> at
> org.apache.camel.util.AsyncProcessorConverterHelper$ProcessorToAsyncProcessorBridge.process(AsyncProcessorConverterHelper.java:61)[camel-core-2.10.0.jar:2.10.0]
> at
> org.apache.camel.util.AsyncProcessorHelper.process(AsyncProcessorHelper.java:73)[camel-core-2.10.0.jar:2.10.0]
> at
> org.apache.camel.processor.SendProcessor$2.doInAsyncProducer(SendProcessor.java:120)[camel-core-2.10.0.jar:2.10.0]
> at
> org.apache.camel.impl.ProducerCache.doInAsyncProducer(ProducerCache.java:292)[camel-core-2.10.0.jar:2.10.0]
> at
> org.apache.camel.processor.SendProcessor.process(SendProcessor.java:115)[camel-core-2.10.0.jar:2.10.0]
> at
> org.apache.camel.util.AsyncProcessorHelper.process(AsyncProcessorHelper.java:73)[camel-core-2.10.0.jar:2.10.0]
> at
> org.apache.camel.processor.DelegateAsyncProcessor.processNext(DelegateAsyncProcessor.java:99)[camel-core-2.10.0.jar:2.10.0]
> at
> org.apache.camel.processor.DelegateAsyncProcessor.process(DelegateAsyncProcessor.java:90)[camel-core-2.10.0.jar:2.10.0]
> at
> org.apache.camel.management.InstrumentationProcessor.process(InstrumentationProcessor.java:73)[camel-core-2.10.0.jar:2.10.0]
> at
> org.apache.camel.util.AsyncProcessorHelper.process(AsyncProcessorHelper.java:73)[camel-core-2.10.0.jar:2.10.0]
> at
> org.apache.camel.processor.DelegateAsyncProcessor.processNext(DelegateAsyncProcessor.java:99)[camel-core-2.10.0.jar:2.10.0]
> at
> org.apache.camel.processor.DelegateAsyncProcessor.process(DelegateAsyncProcessor.java:90)[camel-core-2.10.0.jar:2.10.0]
> at
> org.apache.camel.processor.interceptor.TraceInterceptor.process(TraceInterceptor.java:91)[camel-core-2.10.0.jar:2.10.0]
> at
> org.apache.camel.util.AsyncProcessorHelper.process(AsyncProcessorHelper.java:73)[camel-core-2.10.0.jar:2.10.0]
> at
> org.apache.camel.processor.RedeliveryErrorHandler.processErrorHandler(RedeliveryErrorHandler.java:330)[camel-core-2.10.0.jar:2.10.0]
> at
> org.apache.camel.processor.RedeliveryErrorHandler.process(RedeliveryErrorHandler.java:220)[camel-core-2.10.0.jar:2.10.0]
> at
> org.apache.camel.processor.RouteContextProcessor.processNext(RouteContextProcessor.java:45)[camel-core-2.10.0.jar:2.10.0]
> at
> org.apache.camel.processor.DelegateAsyncProcessor.process(DelegateAsyncProcessor.java:90)[camel-core-2.10.0.jar:2.10.0]
> at
> org.apache.camel.processor.interceptor.DefaultChannel.process(DefaultChannel.java:303)[camel-core-2.10.0.jar:2.10.0]
> at
> org.apache.camel.util.AsyncProcessorHelper.process(AsyncProcessorHelper.java:73)[camel-core-2.10.0.jar:2.10.0]
> at
> org.apache.camel.processor.Pipeline.process(Pipeline.java:117)[camel-core-2.10.0.jar:2.10.0]
> at
> org.apache.camel.processor.Pipeline.process(Pipeline.java:80)[camel-core-2.10.0.jar:2.10.0]
> at
> org.apache.camel.processor.RouteContextProcessor.processNext(RouteContextProcessor.java:45)[camel-core-2.10.0.jar:2.10.0]
> at
> org.apache.camel.processor.DelegateAsyncProcessor.process(DelegateAsyncProcessor.java:90)[camel-core-2.10.0.jar:2.10.0]
> at
> org.apache.camel.processor.UnitOfWorkProcessor.processAsync(UnitOfWorkProcessor.java:150)[camel-core-2.10.0.jar:2.10.0]
> at
> org.apache.camel.processor.UnitOfWorkProcessor.process(UnitOfWorkProcessor.java:117)[camel-core-2.10.0.jar:2.10.0]
> at
> org.apache.camel.processor.RouteInflightRepositoryProcessor.processNext(RouteInflightRepositoryProcessor.java:48)[camel-core-2.10.0.jar:2.10.0]
> at
> org.apache.camel.processor.DelegateAsyncProcessor.process(DelegateAsyncProcessor.java:90)[camel-core-2.10.0.jar:2.10.0]
> at
> org.apache.camel.util.AsyncProcessorHelper.process(AsyncProcessorHelper.java:73)[camel-core-2.10.0.jar:2.10.0]
> at
> org.apache.camel.processor.DelegateAsyncProcessor.processNext(DelegateAsyncProcessor.java:99)[camel-core-2.10.0.jar:2.10.0]
> at
> org.apache.camel.processor.DelegateAsyncProcessor.process(DelegateAsyncProcessor.java:90)[camel-core-2.10.0.jar:2.10.0]
> at
> org.apache.camel.management.InstrumentationProcessor.process(InstrumentationProcessor.java:73)[camel-core-2.10.0.jar:2.10.0]
> at
> org.apache.camel.util.AsyncProcessorHelper.process(AsyncProcessorHelper.java:99)[camel-core-2.10.0.jar:2.10.0]
> at
> org.apache.camel.processor.DelegateAsyncProcessor.process(DelegateAsyncProcessor.java:86)[camel-core-2.10.0.jar:2.10.0]
> at
> org.apache.camel.component.cxf.jaxrs.CxfRsInvoker.syncInvoke(CxfRsInvoker.java:122)[camel-cxf-2.10.0.jar:2.10.0]
> at
> org.apache.camel.component.cxf.jaxrs.CxfRsInvoker.performInvocation(CxfRsInvoker.java:60)[camel-cxf-2.10.0.jar:2.10.0]
> at
> org.apache.cxf.service.invoker.AbstractInvoker.invoke(AbstractInvoker.java:96)[cxf-api-2.6.1.jar:2.6.1]
> at
> org.apache.cxf.jaxrs.JAXRSInvoker.invoke(JAXRSInvoker.java:167)[cxf-rt-frontend-jaxrs-2.6.1.jar:2.6.1]
> at
> org.apache.cxf.jaxrs.JAXRSInvoker.invoke(JAXRSInvoker.java:94)[cxf-rt-frontend-jaxrs-2.6.1.jar:2.6.1]
> at
> org.apache.cxf.interceptor.ServiceInvokerInterceptor$1.run(ServiceInvokerInterceptor.java:58)[cxf-api-2.6.1.jar:2.6.1]
> at
> org.apache.cxf.interceptor.ServiceInvokerInterceptor.handleMessage(ServiceInvokerInterceptor.java:94)[cxf-api-2.6.1.jar:2.6.1]
> at
> org.apache.cxf.phase.PhaseInterceptorChain.doIntercept(PhaseInterceptorChain.java:262)[cxf-api-2.6.1.jar:2.6.1]
> at
> org.apache.cxf.transport.ChainInitiationObserver.onMessage(ChainInitiationObserver.java:122)[cxf-api-2.6.1.jar:2.6.1]
> at
> org.apache.cxf.transport.http.AbstractHTTPDestination.invoke(AbstractHTTPDestination.java:211)[cxf-rt-transports-http-2.6.1.jar:2.6.1]
> at
> org.apache.cxf.transport.servlet.ServletController.invokeDestination(ServletController.java:213)[cxf-rt-transports-http-2.6.1.jar:2.6.1]
> at
> org.apache.cxf.transport.servlet.ServletController.invoke(ServletController.java:154)[cxf-rt-transports-http-2.6.1.jar:2.6.1]
> at
> org.apache.cxf.transport.servlet.CXFNonSpringServlet.invoke(CXFNonSpringServlet.java:129)[cxf-rt-transports-http-2.6.1.jar:2.6.1]
> at
> org.apache.cxf.transport.servlet.AbstractHTTPServlet.handleRequest(AbstractHTTPServlet.java:187)[cxf-rt-transports-http-2.6.1.jar:2.6.1]
> at
> org.apache.cxf.transport.servlet.AbstractHTTPServlet.doGet(AbstractHTTPServlet.java:115)[cxf-rt-transports-http-2.6.1.jar:2.6.1]
> at
> javax.servlet.http.HttpServlet.service(HttpServlet.java:617)[servlet-api-6.0.29.jar:]
> at
> org.apache.cxf.transport.servlet.AbstractHTTPServlet.service(AbstractHTTPServlet.java:166)[cxf-rt-transports-http-2.6.1.jar:2.6.1]
> at
> org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)[catalina-6.0.29.jar:6.0.29]
> at
> org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)[catalina-6.0.29.jar:6.0.29]
> at
> org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:233)[catalina-6.0.29.jar:6.0.29]
> at
> org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:191)[catalina-6.0.29.jar:6.0.29]
> at
> org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:127)[catalina-6.0.29.jar:6.0.29]
> at
> org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)[catalina-6.0.29.jar:6.0.29]
> at
> org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)[catalina-6.0.29.jar:6.0.29]
> at
> org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:298)[catalina-6.0.29.jar:6.0.29]
> at
> org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:857)[coyote-6.0.29.jar:6.0.29]
> at
> org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:588)[coyote-6.0.29.jar:6.0.29]
> at
> org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:489)[coyote-6.0.29.jar:6.0.29]
>
> Attached relevant files.
>
> Any help appreciated.
>
> Regards,
> /Dumitru
>
>
>
>
> --
> View this message in context: http://camel.465427.n5.nabble.com/CxfRsProducer-is-not-thread-safe-tp5716351p5716712.html
> Sent from the Camel - Users mailing list archive at Nabble.com.


Re: CxfRsProducer is not thread safe

Posted by dumi_p <du...@gmail.com>.
Hi,

In the mean time, I tried to use jaxrs:client, but got into another
problem. Seems like <jaxrs:client> accepts only interfaces for the
serviceClass attribute, so I created a new interface
(CustomerServiceInterface) and configured it as it follows:
<jaxrs:client id="rsClient"
address="http://localhost:8080/camel-example-cxf-tomcat/webservices/rest"
serviceClass="org.apache.camel.example.cxf.restobjects.CustomerServiceInterface"
inheritHeaders="true">
<jaxrs:headers>
<entry key="Accept" value="text/xml" />
</jaxrs:headers>
</jaxrs:client>

Route is:
from("cxfrs:bean:rsServer")
.to("log:input")
.to("bean:rsClient")
.to("log:output");

Error I get is:
2012-08-02 23:31:20,894 [http-8080-1    ] ERROR DefaultErrorHandler
   - Failed delivery for (MessageId: ID-Dumi-PC-57364-1343939398047-0-1 on
ExchangeId: ID-Dumi-PC-57364-1343939398047-0-2). Exhausted after delivery
attempt: 1 caught:
org.apache.camel.component.bean.AmbiguousMethodCallException: Ambiguous
method invocations possible: [public final
org.apache.camel.example.cxf.restobjects.Customer
$Proxy49.getCustomer(java.lang.String), public final
org.apache.camel.example.cxf.restobjects.Customer
$Proxy49.getCustomer(java.lang.String)]. Exchange[Message: 123]
org.apache.camel.component.bean.AmbiguousMethodCallException: Ambiguous
method invocations possible: [public final
org.apache.camel.example.cxf.restobjects.Customer
$Proxy49.getCustomer(java.lang.String), public final
org.apache.camel.example.cxf.restobjects.Customer
$Proxy49.getCustomer(java.lang.String)]. Exchange[Message: 123]
at
org.apache.camel.component.bean.BeanInfo.chooseBestPossibleMethodInfo(BeanInfo.java:587)[camel-core-2.10.0.jar:2.10.0]
at
org.apache.camel.component.bean.BeanInfo.chooseMethodWithMatchingBody(BeanInfo.java:544)[camel-core-2.10.0.jar:2.10.0]
at
org.apache.camel.component.bean.BeanInfo.chooseMethod(BeanInfo.java:496)[camel-core-2.10.0.jar:2.10.0]
at
org.apache.camel.component.bean.BeanInfo.createInvocation(BeanInfo.java:225)[camel-core-2.10.0.jar:2.10.0]
at
org.apache.camel.component.bean.BeanInfo.createInvocation(BeanInfo.java:162)[camel-core-2.10.0.jar:2.10.0]
at
org.apache.camel.component.bean.BeanProcessor.process(BeanProcessor.java:149)[camel-core-2.10.0.jar:2.10.0]
at
org.apache.camel.util.AsyncProcessorHelper.process(AsyncProcessorHelper.java:99)[camel-core-2.10.0.jar:2.10.0]
at
org.apache.camel.component.bean.BeanProcessor.process(BeanProcessor.java:73)[camel-core-2.10.0.jar:2.10.0]
at
org.apache.camel.impl.ProcessorEndpoint.onExchange(ProcessorEndpoint.java:101)[camel-core-2.10.0.jar:2.10.0]
at
org.apache.camel.impl.ProcessorEndpoint$1.process(ProcessorEndpoint.java:71)[camel-core-2.10.0.jar:2.10.0]
at
org.apache.camel.util.AsyncProcessorConverterHelper$ProcessorToAsyncProcessorBridge.process(AsyncProcessorConverterHelper.java:61)[camel-core-2.10.0.jar:2.10.0]
at
org.apache.camel.util.AsyncProcessorHelper.process(AsyncProcessorHelper.java:73)[camel-core-2.10.0.jar:2.10.0]
at
org.apache.camel.processor.SendProcessor$2.doInAsyncProducer(SendProcessor.java:120)[camel-core-2.10.0.jar:2.10.0]
at
org.apache.camel.impl.ProducerCache.doInAsyncProducer(ProducerCache.java:292)[camel-core-2.10.0.jar:2.10.0]
at
org.apache.camel.processor.SendProcessor.process(SendProcessor.java:115)[camel-core-2.10.0.jar:2.10.0]
at
org.apache.camel.util.AsyncProcessorHelper.process(AsyncProcessorHelper.java:73)[camel-core-2.10.0.jar:2.10.0]
at
org.apache.camel.processor.DelegateAsyncProcessor.processNext(DelegateAsyncProcessor.java:99)[camel-core-2.10.0.jar:2.10.0]
at
org.apache.camel.processor.DelegateAsyncProcessor.process(DelegateAsyncProcessor.java:90)[camel-core-2.10.0.jar:2.10.0]
at
org.apache.camel.management.InstrumentationProcessor.process(InstrumentationProcessor.java:73)[camel-core-2.10.0.jar:2.10.0]
at
org.apache.camel.util.AsyncProcessorHelper.process(AsyncProcessorHelper.java:73)[camel-core-2.10.0.jar:2.10.0]
at
org.apache.camel.processor.DelegateAsyncProcessor.processNext(DelegateAsyncProcessor.java:99)[camel-core-2.10.0.jar:2.10.0]
at
org.apache.camel.processor.DelegateAsyncProcessor.process(DelegateAsyncProcessor.java:90)[camel-core-2.10.0.jar:2.10.0]
at
org.apache.camel.processor.interceptor.TraceInterceptor.process(TraceInterceptor.java:91)[camel-core-2.10.0.jar:2.10.0]
at
org.apache.camel.util.AsyncProcessorHelper.process(AsyncProcessorHelper.java:73)[camel-core-2.10.0.jar:2.10.0]
at
org.apache.camel.processor.RedeliveryErrorHandler.processErrorHandler(RedeliveryErrorHandler.java:330)[camel-core-2.10.0.jar:2.10.0]
at
org.apache.camel.processor.RedeliveryErrorHandler.process(RedeliveryErrorHandler.java:220)[camel-core-2.10.0.jar:2.10.0]
at
org.apache.camel.processor.RouteContextProcessor.processNext(RouteContextProcessor.java:45)[camel-core-2.10.0.jar:2.10.0]
at
org.apache.camel.processor.DelegateAsyncProcessor.process(DelegateAsyncProcessor.java:90)[camel-core-2.10.0.jar:2.10.0]
at
org.apache.camel.processor.interceptor.DefaultChannel.process(DefaultChannel.java:303)[camel-core-2.10.0.jar:2.10.0]
at
org.apache.camel.util.AsyncProcessorHelper.process(AsyncProcessorHelper.java:73)[camel-core-2.10.0.jar:2.10.0]
at
org.apache.camel.processor.Pipeline.process(Pipeline.java:117)[camel-core-2.10.0.jar:2.10.0]
at
org.apache.camel.processor.Pipeline.process(Pipeline.java:80)[camel-core-2.10.0.jar:2.10.0]
at
org.apache.camel.processor.RouteContextProcessor.processNext(RouteContextProcessor.java:45)[camel-core-2.10.0.jar:2.10.0]
at
org.apache.camel.processor.DelegateAsyncProcessor.process(DelegateAsyncProcessor.java:90)[camel-core-2.10.0.jar:2.10.0]
at
org.apache.camel.processor.UnitOfWorkProcessor.processAsync(UnitOfWorkProcessor.java:150)[camel-core-2.10.0.jar:2.10.0]
at
org.apache.camel.processor.UnitOfWorkProcessor.process(UnitOfWorkProcessor.java:117)[camel-core-2.10.0.jar:2.10.0]
at
org.apache.camel.processor.RouteInflightRepositoryProcessor.processNext(RouteInflightRepositoryProcessor.java:48)[camel-core-2.10.0.jar:2.10.0]
at
org.apache.camel.processor.DelegateAsyncProcessor.process(DelegateAsyncProcessor.java:90)[camel-core-2.10.0.jar:2.10.0]
at
org.apache.camel.util.AsyncProcessorHelper.process(AsyncProcessorHelper.java:73)[camel-core-2.10.0.jar:2.10.0]
at
org.apache.camel.processor.DelegateAsyncProcessor.processNext(DelegateAsyncProcessor.java:99)[camel-core-2.10.0.jar:2.10.0]
at
org.apache.camel.processor.DelegateAsyncProcessor.process(DelegateAsyncProcessor.java:90)[camel-core-2.10.0.jar:2.10.0]
at
org.apache.camel.management.InstrumentationProcessor.process(InstrumentationProcessor.java:73)[camel-core-2.10.0.jar:2.10.0]
at
org.apache.camel.util.AsyncProcessorHelper.process(AsyncProcessorHelper.java:99)[camel-core-2.10.0.jar:2.10.0]
at
org.apache.camel.processor.DelegateAsyncProcessor.process(DelegateAsyncProcessor.java:86)[camel-core-2.10.0.jar:2.10.0]
at
org.apache.camel.component.cxf.jaxrs.CxfRsInvoker.syncInvoke(CxfRsInvoker.java:122)[camel-cxf-2.10.0.jar:2.10.0]
at
org.apache.camel.component.cxf.jaxrs.CxfRsInvoker.performInvocation(CxfRsInvoker.java:60)[camel-cxf-2.10.0.jar:2.10.0]
at
org.apache.cxf.service.invoker.AbstractInvoker.invoke(AbstractInvoker.java:96)[cxf-api-2.6.1.jar:2.6.1]
at
org.apache.cxf.jaxrs.JAXRSInvoker.invoke(JAXRSInvoker.java:167)[cxf-rt-frontend-jaxrs-2.6.1.jar:2.6.1]
at
org.apache.cxf.jaxrs.JAXRSInvoker.invoke(JAXRSInvoker.java:94)[cxf-rt-frontend-jaxrs-2.6.1.jar:2.6.1]
at
org.apache.cxf.interceptor.ServiceInvokerInterceptor$1.run(ServiceInvokerInterceptor.java:58)[cxf-api-2.6.1.jar:2.6.1]
at
org.apache.cxf.interceptor.ServiceInvokerInterceptor.handleMessage(ServiceInvokerInterceptor.java:94)[cxf-api-2.6.1.jar:2.6.1]
at
org.apache.cxf.phase.PhaseInterceptorChain.doIntercept(PhaseInterceptorChain.java:262)[cxf-api-2.6.1.jar:2.6.1]
at
org.apache.cxf.transport.ChainInitiationObserver.onMessage(ChainInitiationObserver.java:122)[cxf-api-2.6.1.jar:2.6.1]
at
org.apache.cxf.transport.http.AbstractHTTPDestination.invoke(AbstractHTTPDestination.java:211)[cxf-rt-transports-http-2.6.1.jar:2.6.1]
at
org.apache.cxf.transport.servlet.ServletController.invokeDestination(ServletController.java:213)[cxf-rt-transports-http-2.6.1.jar:2.6.1]
at
org.apache.cxf.transport.servlet.ServletController.invoke(ServletController.java:154)[cxf-rt-transports-http-2.6.1.jar:2.6.1]
at
org.apache.cxf.transport.servlet.CXFNonSpringServlet.invoke(CXFNonSpringServlet.java:129)[cxf-rt-transports-http-2.6.1.jar:2.6.1]
at
org.apache.cxf.transport.servlet.AbstractHTTPServlet.handleRequest(AbstractHTTPServlet.java:187)[cxf-rt-transports-http-2.6.1.jar:2.6.1]
at
org.apache.cxf.transport.servlet.AbstractHTTPServlet.doGet(AbstractHTTPServlet.java:115)[cxf-rt-transports-http-2.6.1.jar:2.6.1]
at
javax.servlet.http.HttpServlet.service(HttpServlet.java:617)[servlet-api-6.0.29.jar:]
at
org.apache.cxf.transport.servlet.AbstractHTTPServlet.service(AbstractHTTPServlet.java:166)[cxf-rt-transports-http-2.6.1.jar:2.6.1]
at
org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)[catalina-6.0.29.jar:6.0.29]
at
org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)[catalina-6.0.29.jar:6.0.29]
at
org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:233)[catalina-6.0.29.jar:6.0.29]
at
org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:191)[catalina-6.0.29.jar:6.0.29]
at
org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:127)[catalina-6.0.29.jar:6.0.29]
at
org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)[catalina-6.0.29.jar:6.0.29]
at
org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)[catalina-6.0.29.jar:6.0.29]
at
org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:298)[catalina-6.0.29.jar:6.0.29]
at
org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:857)[coyote-6.0.29.jar:6.0.29]
at
org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:588)[coyote-6.0.29.jar:6.0.29]
at
org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:489)[coyote-6.0.29.jar:6.0.29]

Attached relevant files.

Any help appreciated.

Regards,
/Dumitru




--
View this message in context: http://camel.465427.n5.nabble.com/CxfRsProducer-is-not-thread-safe-tp5716351p5716712.html
Sent from the Camel - Users mailing list archive at Nabble.com.

Re: CxfRsProducer is not thread safe

Posted by Willem Jiang <wi...@gmail.com>.
Dumitru do you mind to create a JIRA[1] here.
It will be helpful for us to trace the issue.

[1]https://issues.apache.org/jira/browse/CAMEL

Willem

On Thu, Jul 26, 2012 at 2:55 AM, dumi_p <du...@gmail.com> wrote:
> Hi Sergey,
>
> Sorry for the late response, I could not work today on the issue - other
> things to do :-(. I will reproduce it tomorrow and send you the full code,
> together with the JMX for JMeter load test.
>
> Note in my test, with 10 concurrent threads it was failing on more than 20
> percent of the requests.
>
> Best regards,
> /Dumitru
>
> On Wed, Jul 25, 2012 at 7:41 PM, Sergey Beryozkin-3 [via Camel] <
> ml-node+s465427n5716473h84@n5.nabble.com> wrote:
>
>> As a sanity check I've run the multi-threaded test on the trunk and
>> 2.9.x due to diff CXF versions being used there, still things work OK.
>>
>> Dumitru, I've been telling everyone CXF RS producer is broken :-), so
>> need your help with reproducing the case. Are you having multiple
>> threads running within a route builder itself ? Please provide more info
>>
>> Sergey
>> On 25/07/12 14:44, Sergey Beryozkin wrote:
>>
>> > Dumitru,
>> >
>> > I'm not seeing in
>> > http://camel.465427.n5.nabble.com/file/n5716351/camel-config.xml
>> > how the route is initiated, can you provide the source of the updated
>> > org.apache.camel.example.cxf.CamelRoute ?
>> >
>> > I've updated one of the tests which Willem created to get 500 threads
>> > stressing the rs client code, can not reproduce the issue
>> >
>> > Cheers, Sergey
>> >
>> > On 24/07/12 02:45, Willem Jiang wrote:
>> >> On Tue, Jul 24, 2012 at 6:16 AM, Sergey
>> >> Beryozkin<[hidden email]<http://user/SendEmail.jtp?type=node&node=5716473&i=0>>wrote:
>>
>> >>
>> >>> Hi
>> >>>
>> >>> On 23/07/12 17:38, dumi_p wrote:
>> >>>
>> >>>> Hi all,
>> >>>>
>> >>>> I am using Camel 2.10.0 deployed on Tomcat 7 and I try to test
>> >>>> following
>> >>>> scenario:
>> >>>>
>> >>>> 1. Have a CXF rest service deployed
>> >>>> 2. Have a proxy CXF rest service over the service above, deployed
>> under
>> >>>> the
>> >>>> same Camel instance
>> >>>>
>> >>>> It works fine, until I perform requests in parallel. Exception
>> >>>> stacktrace
>> >>>> is
>> >>>> attached.
>> >>>> http://camel.465427.n5.nabble.**com/file/n5716351/stacktrace.*
>> >>>> *txt<http://camel.465427.n5.nabble.com/file/n5716351/stacktrace.txt>
>> >>>> stacktrace.txt
>> >>>>
>> >>>> I tried following things in class
>> >>>> org.apache.camel.component.**cxf.jaxrs.CxfRsProducer order to fix it:
>> >>>> 1. Invoked JAXRSClientFactoryBean.**setThreadSafe(true), with no
>> >>>> success
>> >>>> 2. Added synchronization point over line WebClient client =
>> >>>> cfb.createWebClient(), from invokeHttpClient method. It works, but
>> >>>> performance dropped on my localhost from 150 requests per second to
>> 10
>> >>>> requests per second, so the fix is not acceptable.
>> >>>>
>> >>>> I attach my camel-config.xml - please let me know if additional info
>> is
>> >>>> needed. http://camel.465427.n5.nabble.**com/file/n5716351/camel-**
>> >>>> config.xml<
>> http://camel.465427.n5.nabble.com/file/n5716351/camel-config.xml>
>> >>>>
>> >>>> camel-config.xml
>> >>>>
>> >>>> I am not sure if the problem lies in the configuration I performed
>> >>>> or in
>> >>>> the
>> >>>> cxf-rs component or in cxf itself.
>> >>>>
>> >>>> Any idea is appreciated.
>> >>>>
>> >>>> Well,I look at the code and see some JAXRSClientFactoryBean cache -
>> >>> Willem can you comment on this please ? This looks suspicious.
>> >>>
>> >>
>> >> I don't like the JAXRSClientFactoryBean cache either, it is used to
>> >> create the WebClient if we change the URI per request. Now I just want
>> to
>> >> ask if there is a way to override the server address by setting the
>> >> context
>> >> per request in the WebClient.
>> >>
>> >> If So , it could easy for use to resolve the issue.
>> >>
>> >>
>> >>> The trace shows that the thread safety is compromised at the point of
>> >>> creating web clients. I can work on a patch - though will take me a
>> >>> bit of
>> >>> time to get to it
>> >>>
>> >>> Dumitru - any chance you can declare jaxrs:client or WebClient [1,2]
>> >>> explicitly, with a thread safe flag set and reuse it in the routes
>> >>> directly
>> >>> ? That should do it.
>> >>>
>> >>> Thanks
>> >>> Sergey
>> >>>
>> >>> [1]
>> >>> http://cxf.apache.org/docs/**jax-rs-client-api.html#JAX-**RSClientAPI-
>> >>> **ConfiguringHTTPclientsinSpring<
>> http://cxf.apache.org/docs/jax-rs-client-api.html#JAX-RSClientAPI-ConfiguringHTTPclientsinSpring>
>>
>> >>>
>> >>> [2]
>> >>> http://cxf.apache.org/docs/**jax-rs-client-api.html#JAX-**RSClientAPI-
>> >>> **ConfiguringproxiesinSpring<
>> http://cxf.apache.org/docs/jax-rs-client-api.html#JAX-RSClientAPI-ConfiguringproxiesinSpring>
>>
>> >>>
>> >>> [2]
>> >>>
>> >>>
>> >>> Best regards,
>> >>>> Dumitru
>> >>>>
>> >>>>
>> >>>>
>> >>>> --
>> >>>> View this message in context: http://camel.465427.n5.nabble.**
>> >>>> com/CxfRsProducer-is-not-**thread-safe-tp5716351.html<
>> http://camel.465427.n5.nabble.com/CxfRsProducer-is-not-thread-safe-tp5716351.html>
>>
>> >>>>
>> >>>> Sent from the Camel - Users mailing list archive at Nabble.com.
>> >>>>
>> >>>
>> >>>
>> >>
>>
>>
>>
>> ------------------------------
>>  If you reply to this email, your message will be added to the discussion
>> below:
>>
>> http://camel.465427.n5.nabble.com/CxfRsProducer-is-not-thread-safe-tp5716351p5716473.html
>>  To unsubscribe from CxfRsProducer is not thread safe, click here<http://camel.465427.n5.nabble.com/template/NamlServlet.jtp?macro=unsubscribe_by_code&node=5716351&code=ZHVtaXRydS5wYXNjdUBnbWFpbC5jb218NTcxNjM1MXwtMTk2Nzc0NjQwNQ==>
>> .
>> NAML<http://camel.465427.n5.nabble.com/template/NamlServlet.jtp?macro=macro_viewer&id=instant_html%21nabble%3Aemail.naml&base=nabble.naml.namespaces.BasicNamespace-nabble.view.web.template.NabbleNamespace-nabble.view.web.template.NodeNamespace&breadcrumbs=notify_subscribers%21nabble%3Aemail.naml-instant_emails%21nabble%3Aemail.naml-send_instant_email%21nabble%3Aemail.naml>
>>
>
>
>
>
> --
> View this message in context: http://camel.465427.n5.nabble.com/CxfRsProducer-is-not-thread-safe-tp5716351p5716475.html
> Sent from the Camel - Users mailing list archive at Nabble.com.

Re: CxfRsProducer is not thread safe

Posted by dumi_p <du...@gmail.com>.
Hi Sergey,

Sorry for the late response, I could not work today on the issue - other
things to do :-(. I will reproduce it tomorrow and send you the full code,
together with the JMX for JMeter load test.

Note in my test, with 10 concurrent threads it was failing on more than 20
percent of the requests.

Best regards,
/Dumitru

On Wed, Jul 25, 2012 at 7:41 PM, Sergey Beryozkin-3 [via Camel] <
ml-node+s465427n5716473h84@n5.nabble.com> wrote:

> As a sanity check I've run the multi-threaded test on the trunk and
> 2.9.x due to diff CXF versions being used there, still things work OK.
>
> Dumitru, I've been telling everyone CXF RS producer is broken :-), so
> need your help with reproducing the case. Are you having multiple
> threads running within a route builder itself ? Please provide more info
>
> Sergey
> On 25/07/12 14:44, Sergey Beryozkin wrote:
>
> > Dumitru,
> >
> > I'm not seeing in
> > http://camel.465427.n5.nabble.com/file/n5716351/camel-config.xml
> > how the route is initiated, can you provide the source of the updated
> > org.apache.camel.example.cxf.CamelRoute ?
> >
> > I've updated one of the tests which Willem created to get 500 threads
> > stressing the rs client code, can not reproduce the issue
> >
> > Cheers, Sergey
> >
> > On 24/07/12 02:45, Willem Jiang wrote:
> >> On Tue, Jul 24, 2012 at 6:16 AM, Sergey
> >> Beryozkin<[hidden email]<http://user/SendEmail.jtp?type=node&node=5716473&i=0>>wrote:
>
> >>
> >>> Hi
> >>>
> >>> On 23/07/12 17:38, dumi_p wrote:
> >>>
> >>>> Hi all,
> >>>>
> >>>> I am using Camel 2.10.0 deployed on Tomcat 7 and I try to test
> >>>> following
> >>>> scenario:
> >>>>
> >>>> 1. Have a CXF rest service deployed
> >>>> 2. Have a proxy CXF rest service over the service above, deployed
> under
> >>>> the
> >>>> same Camel instance
> >>>>
> >>>> It works fine, until I perform requests in parallel. Exception
> >>>> stacktrace
> >>>> is
> >>>> attached.
> >>>> http://camel.465427.n5.nabble.**com/file/n5716351/stacktrace.*
> >>>> *txt<http://camel.465427.n5.nabble.com/file/n5716351/stacktrace.txt>
> >>>> stacktrace.txt
> >>>>
> >>>> I tried following things in class
> >>>> org.apache.camel.component.**cxf.jaxrs.CxfRsProducer order to fix it:
> >>>> 1. Invoked JAXRSClientFactoryBean.**setThreadSafe(true), with no
> >>>> success
> >>>> 2. Added synchronization point over line WebClient client =
> >>>> cfb.createWebClient(), from invokeHttpClient method. It works, but
> >>>> performance dropped on my localhost from 150 requests per second to
> 10
> >>>> requests per second, so the fix is not acceptable.
> >>>>
> >>>> I attach my camel-config.xml - please let me know if additional info
> is
> >>>> needed. http://camel.465427.n5.nabble.**com/file/n5716351/camel-**
> >>>> config.xml<
> http://camel.465427.n5.nabble.com/file/n5716351/camel-config.xml>
> >>>>
> >>>> camel-config.xml
> >>>>
> >>>> I am not sure if the problem lies in the configuration I performed
> >>>> or in
> >>>> the
> >>>> cxf-rs component or in cxf itself.
> >>>>
> >>>> Any idea is appreciated.
> >>>>
> >>>> Well,I look at the code and see some JAXRSClientFactoryBean cache -
> >>> Willem can you comment on this please ? This looks suspicious.
> >>>
> >>
> >> I don't like the JAXRSClientFactoryBean cache either, it is used to
> >> create the WebClient if we change the URI per request. Now I just want
> to
> >> ask if there is a way to override the server address by setting the
> >> context
> >> per request in the WebClient.
> >>
> >> If So , it could easy for use to resolve the issue.
> >>
> >>
> >>> The trace shows that the thread safety is compromised at the point of
> >>> creating web clients. I can work on a patch - though will take me a
> >>> bit of
> >>> time to get to it
> >>>
> >>> Dumitru - any chance you can declare jaxrs:client or WebClient [1,2]
> >>> explicitly, with a thread safe flag set and reuse it in the routes
> >>> directly
> >>> ? That should do it.
> >>>
> >>> Thanks
> >>> Sergey
> >>>
> >>> [1]
> >>> http://cxf.apache.org/docs/**jax-rs-client-api.html#JAX-**RSClientAPI-
> >>> **ConfiguringHTTPclientsinSpring<
> http://cxf.apache.org/docs/jax-rs-client-api.html#JAX-RSClientAPI-ConfiguringHTTPclientsinSpring>
>
> >>>
> >>> [2]
> >>> http://cxf.apache.org/docs/**jax-rs-client-api.html#JAX-**RSClientAPI-
> >>> **ConfiguringproxiesinSpring<
> http://cxf.apache.org/docs/jax-rs-client-api.html#JAX-RSClientAPI-ConfiguringproxiesinSpring>
>
> >>>
> >>> [2]
> >>>
> >>>
> >>> Best regards,
> >>>> Dumitru
> >>>>
> >>>>
> >>>>
> >>>> --
> >>>> View this message in context: http://camel.465427.n5.nabble.**
> >>>> com/CxfRsProducer-is-not-**thread-safe-tp5716351.html<
> http://camel.465427.n5.nabble.com/CxfRsProducer-is-not-thread-safe-tp5716351.html>
>
> >>>>
> >>>> Sent from the Camel - Users mailing list archive at Nabble.com.
> >>>>
> >>>
> >>>
> >>
>
>
>
> ------------------------------
>  If you reply to this email, your message will be added to the discussion
> below:
>
> http://camel.465427.n5.nabble.com/CxfRsProducer-is-not-thread-safe-tp5716351p5716473.html
>  To unsubscribe from CxfRsProducer is not thread safe, click here<http://camel.465427.n5.nabble.com/template/NamlServlet.jtp?macro=unsubscribe_by_code&node=5716351&code=ZHVtaXRydS5wYXNjdUBnbWFpbC5jb218NTcxNjM1MXwtMTk2Nzc0NjQwNQ==>
> .
> NAML<http://camel.465427.n5.nabble.com/template/NamlServlet.jtp?macro=macro_viewer&id=instant_html%21nabble%3Aemail.naml&base=nabble.naml.namespaces.BasicNamespace-nabble.view.web.template.NabbleNamespace-nabble.view.web.template.NodeNamespace&breadcrumbs=notify_subscribers%21nabble%3Aemail.naml-instant_emails%21nabble%3Aemail.naml-send_instant_email%21nabble%3Aemail.naml>
>




--
View this message in context: http://camel.465427.n5.nabble.com/CxfRsProducer-is-not-thread-safe-tp5716351p5716475.html
Sent from the Camel - Users mailing list archive at Nabble.com.

Re: CxfRsProducer is not thread safe

Posted by Sergey Beryozkin <sb...@gmail.com>.
As a sanity check I've run the multi-threaded test on the trunk and 
2.9.x due to diff CXF versions being used there, still things work OK.

Dumitru, I've been telling everyone CXF RS producer is broken :-), so 
need your help with reproducing the case. Are you having multiple 
threads running within a route builder itself ? Please provide more info

Sergey
On 25/07/12 14:44, Sergey Beryozkin wrote:
> Dumitru,
>
> I'm not seeing in
> http://camel.465427.n5.nabble.com/file/n5716351/camel-config.xml
> how the route is initiated, can you provide the source of the updated
> org.apache.camel.example.cxf.CamelRoute ?
>
> I've updated one of the tests which Willem created to get 500 threads
> stressing the rs client code, can not reproduce the issue
>
> Cheers, Sergey
>
> On 24/07/12 02:45, Willem Jiang wrote:
>> On Tue, Jul 24, 2012 at 6:16 AM, Sergey
>> Beryozkin<sb...@gmail.com>wrote:
>>
>>> Hi
>>>
>>> On 23/07/12 17:38, dumi_p wrote:
>>>
>>>> Hi all,
>>>>
>>>> I am using Camel 2.10.0 deployed on Tomcat 7 and I try to test
>>>> following
>>>> scenario:
>>>>
>>>> 1. Have a CXF rest service deployed
>>>> 2. Have a proxy CXF rest service over the service above, deployed under
>>>> the
>>>> same Camel instance
>>>>
>>>> It works fine, until I perform requests in parallel. Exception
>>>> stacktrace
>>>> is
>>>> attached.
>>>> http://camel.465427.n5.nabble.**com/file/n5716351/stacktrace.*
>>>> *txt<http://camel.465427.n5.nabble.com/file/n5716351/stacktrace.txt>
>>>> stacktrace.txt
>>>>
>>>> I tried following things in class
>>>> org.apache.camel.component.**cxf.jaxrs.CxfRsProducer order to fix it:
>>>> 1. Invoked JAXRSClientFactoryBean.**setThreadSafe(true), with no
>>>> success
>>>> 2. Added synchronization point over line WebClient client =
>>>> cfb.createWebClient(), from invokeHttpClient method. It works, but
>>>> performance dropped on my localhost from 150 requests per second to 10
>>>> requests per second, so the fix is not acceptable.
>>>>
>>>> I attach my camel-config.xml - please let me know if additional info is
>>>> needed. http://camel.465427.n5.nabble.**com/file/n5716351/camel-**
>>>> config.xml<http://camel.465427.n5.nabble.com/file/n5716351/camel-config.xml>
>>>>
>>>> camel-config.xml
>>>>
>>>> I am not sure if the problem lies in the configuration I performed
>>>> or in
>>>> the
>>>> cxf-rs component or in cxf itself.
>>>>
>>>> Any idea is appreciated.
>>>>
>>>> Well,I look at the code and see some JAXRSClientFactoryBean cache -
>>> Willem can you comment on this please ? This looks suspicious.
>>>
>>
>> I don't like the JAXRSClientFactoryBean cache either, it is used to
>> create the WebClient if we change the URI per request. Now I just want to
>> ask if there is a way to override the server address by setting the
>> context
>> per request in the WebClient.
>>
>> If So , it could easy for use to resolve the issue.
>>
>>
>>> The trace shows that the thread safety is compromised at the point of
>>> creating web clients. I can work on a patch - though will take me a
>>> bit of
>>> time to get to it
>>>
>>> Dumitru - any chance you can declare jaxrs:client or WebClient [1,2]
>>> explicitly, with a thread safe flag set and reuse it in the routes
>>> directly
>>> ? That should do it.
>>>
>>> Thanks
>>> Sergey
>>>
>>> [1]
>>> http://cxf.apache.org/docs/**jax-rs-client-api.html#JAX-**RSClientAPI-
>>> **ConfiguringHTTPclientsinSpring<http://cxf.apache.org/docs/jax-rs-client-api.html#JAX-RSClientAPI-ConfiguringHTTPclientsinSpring>
>>>
>>> [2]
>>> http://cxf.apache.org/docs/**jax-rs-client-api.html#JAX-**RSClientAPI-
>>> **ConfiguringproxiesinSpring<http://cxf.apache.org/docs/jax-rs-client-api.html#JAX-RSClientAPI-ConfiguringproxiesinSpring>
>>>
>>> [2]
>>>
>>>
>>> Best regards,
>>>> Dumitru
>>>>
>>>>
>>>>
>>>> --
>>>> View this message in context: http://camel.465427.n5.nabble.**
>>>> com/CxfRsProducer-is-not-**thread-safe-tp5716351.html<http://camel.465427.n5.nabble.com/CxfRsProducer-is-not-thread-safe-tp5716351.html>
>>>>
>>>> Sent from the Camel - Users mailing list archive at Nabble.com.
>>>>
>>>
>>>
>>


Re: CxfRsProducer is not thread safe

Posted by Sergey Beryozkin <sb...@gmail.com>.
Dumitru,

I'm not seeing in
http://camel.465427.n5.nabble.com/file/n5716351/camel-config.xml
how the route is initiated, can you provide the source of the updated
org.apache.camel.example.cxf.CamelRoute ?

I've updated one of the tests which Willem created to get 500 threads 
stressing the rs client code, can not reproduce the issue

Cheers, Sergey

On 24/07/12 02:45, Willem Jiang wrote:
> On Tue, Jul 24, 2012 at 6:16 AM, Sergey Beryozkin<sb...@gmail.com>wrote:
>
>> Hi
>>
>> On 23/07/12 17:38, dumi_p wrote:
>>
>>> Hi all,
>>>
>>> I am using Camel 2.10.0 deployed on Tomcat 7 and I try to test following
>>> scenario:
>>>
>>> 1. Have a CXF rest service deployed
>>> 2. Have a proxy CXF rest service over the service above, deployed under
>>> the
>>> same Camel instance
>>>
>>> It works fine, until I perform requests in parallel. Exception stacktrace
>>> is
>>> attached.  http://camel.465427.n5.nabble.**com/file/n5716351/stacktrace.*
>>> *txt<http://camel.465427.n5.nabble.com/file/n5716351/stacktrace.txt>
>>> stacktrace.txt
>>>
>>> I tried following things in class
>>> org.apache.camel.component.**cxf.jaxrs.CxfRsProducer order to fix it:
>>> 1. Invoked JAXRSClientFactoryBean.**setThreadSafe(true), with no success
>>> 2. Added synchronization point over line WebClient client =
>>> cfb.createWebClient(), from invokeHttpClient method. It works, but
>>> performance dropped on my localhost from 150 requests per second to 10
>>> requests per second, so the fix is not acceptable.
>>>
>>> I attach my camel-config.xml - please let me know if additional info is
>>> needed. http://camel.465427.n5.nabble.**com/file/n5716351/camel-**
>>> config.xml<http://camel.465427.n5.nabble.com/file/n5716351/camel-config.xml>
>>> camel-config.xml
>>>
>>> I am not sure if the problem lies in the configuration I performed or in
>>> the
>>> cxf-rs component or in cxf itself.
>>>
>>> Any idea is appreciated.
>>>
>>>   Well,I look at the code and see some JAXRSClientFactoryBean cache -
>> Willem can you comment on this please ? This looks suspicious.
>>
>
> I don't like the   JAXRSClientFactoryBean cache either, it is used to
> create the WebClient if we change the URI per request. Now I just want to
> ask if there is a way to override the server address by setting the context
> per request in the WebClient.
>
> If So , it could easy for use to resolve the issue.
>
>
>> The trace shows that the thread safety is compromised at the point of
>> creating web clients. I can work on a patch - though will take me a bit of
>> time to get to it
>>
>> Dumitru - any chance you can declare jaxrs:client or WebClient [1,2]
>> explicitly, with a thread safe flag set and reuse it in the routes directly
>> ? That should do it.
>>
>> Thanks
>> Sergey
>>
>> [1] http://cxf.apache.org/docs/**jax-rs-client-api.html#JAX-**RSClientAPI-
>> **ConfiguringHTTPclientsinSpring<http://cxf.apache.org/docs/jax-rs-client-api.html#JAX-RSClientAPI-ConfiguringHTTPclientsinSpring>
>> [2] http://cxf.apache.org/docs/**jax-rs-client-api.html#JAX-**RSClientAPI-
>> **ConfiguringproxiesinSpring<http://cxf.apache.org/docs/jax-rs-client-api.html#JAX-RSClientAPI-ConfiguringproxiesinSpring>
>> [2]
>>
>>
>>   Best regards,
>>> Dumitru
>>>
>>>
>>>
>>> --
>>> View this message in context: http://camel.465427.n5.nabble.**
>>> com/CxfRsProducer-is-not-**thread-safe-tp5716351.html<http://camel.465427.n5.nabble.com/CxfRsProducer-is-not-thread-safe-tp5716351.html>
>>> Sent from the Camel - Users mailing list archive at Nabble.com.
>>>
>>
>>
>

Re: CxfRsProducer is not thread safe

Posted by Willem Jiang <wi...@gmail.com>.
On Tue, Jul 24, 2012 at 6:16 AM, Sergey Beryozkin <sb...@gmail.com>wrote:

> Hi
>
> On 23/07/12 17:38, dumi_p wrote:
>
>> Hi all,
>>
>> I am using Camel 2.10.0 deployed on Tomcat 7 and I try to test following
>> scenario:
>>
>> 1. Have a CXF rest service deployed
>> 2. Have a proxy CXF rest service over the service above, deployed under
>> the
>> same Camel instance
>>
>> It works fine, until I perform requests in parallel. Exception stacktrace
>> is
>> attached.  http://camel.465427.n5.nabble.**com/file/n5716351/stacktrace.*
>> *txt <http://camel.465427.n5.nabble.com/file/n5716351/stacktrace.txt>
>> stacktrace.txt
>>
>> I tried following things in class
>> org.apache.camel.component.**cxf.jaxrs.CxfRsProducer order to fix it:
>> 1. Invoked JAXRSClientFactoryBean.**setThreadSafe(true), with no success
>> 2. Added synchronization point over line WebClient client =
>> cfb.createWebClient(), from invokeHttpClient method. It works, but
>> performance dropped on my localhost from 150 requests per second to 10
>> requests per second, so the fix is not acceptable.
>>
>> I attach my camel-config.xml - please let me know if additional info is
>> needed. http://camel.465427.n5.nabble.**com/file/n5716351/camel-**
>> config.xml<http://camel.465427.n5.nabble.com/file/n5716351/camel-config.xml>
>> camel-config.xml
>>
>> I am not sure if the problem lies in the configuration I performed or in
>> the
>> cxf-rs component or in cxf itself.
>>
>> Any idea is appreciated.
>>
>>  Well,I look at the code and see some JAXRSClientFactoryBean cache -
> Willem can you comment on this please ? This looks suspicious.
>

I don't like the   JAXRSClientFactoryBean cache either, it is used to
create the WebClient if we change the URI per request. Now I just want to
ask if there is a way to override the server address by setting the context
per request in the WebClient.

If So , it could easy for use to resolve the issue.


> The trace shows that the thread safety is compromised at the point of
> creating web clients. I can work on a patch - though will take me a bit of
> time to get to it
>
> Dumitru - any chance you can declare jaxrs:client or WebClient [1,2]
> explicitly, with a thread safe flag set and reuse it in the routes directly
> ? That should do it.
>
> Thanks
> Sergey
>
> [1] http://cxf.apache.org/docs/**jax-rs-client-api.html#JAX-**RSClientAPI-
> **ConfiguringHTTPclientsinSpring<http://cxf.apache.org/docs/jax-rs-client-api.html#JAX-RSClientAPI-ConfiguringHTTPclientsinSpring>
> [2] http://cxf.apache.org/docs/**jax-rs-client-api.html#JAX-**RSClientAPI-
> **ConfiguringproxiesinSpring<http://cxf.apache.org/docs/jax-rs-client-api.html#JAX-RSClientAPI-ConfiguringproxiesinSpring>
> [2]
>
>
>  Best regards,
>> Dumitru
>>
>>
>>
>> --
>> View this message in context: http://camel.465427.n5.nabble.**
>> com/CxfRsProducer-is-not-**thread-safe-tp5716351.html<http://camel.465427.n5.nabble.com/CxfRsProducer-is-not-thread-safe-tp5716351.html>
>> Sent from the Camel - Users mailing list archive at Nabble.com.
>>
>
>

Re: CxfRsProducer is not thread safe

Posted by Sergey Beryozkin <sb...@gmail.com>.
Hi
On 23/07/12 17:38, dumi_p wrote:
> Hi all,
>
> I am using Camel 2.10.0 deployed on Tomcat 7 and I try to test following
> scenario:
>
> 1. Have a CXF rest service deployed
> 2. Have a proxy CXF rest service over the service above, deployed under the
> same Camel instance
>
> It works fine, until I perform requests in parallel. Exception stacktrace is
> attached.  http://camel.465427.n5.nabble.com/file/n5716351/stacktrace.txt
> stacktrace.txt
>
> I tried following things in class
> org.apache.camel.component.cxf.jaxrs.CxfRsProducer order to fix it:
> 1. Invoked JAXRSClientFactoryBean.setThreadSafe(true), with no success
> 2. Added synchronization point over line WebClient client =
> cfb.createWebClient(), from invokeHttpClient method. It works, but
> performance dropped on my localhost from 150 requests per second to 10
> requests per second, so the fix is not acceptable.
>
> I attach my camel-config.xml - please let me know if additional info is
> needed. http://camel.465427.n5.nabble.com/file/n5716351/camel-config.xml
> camel-config.xml
>
> I am not sure if the problem lies in the configuration I performed or in the
> cxf-rs component or in cxf itself.
>
> Any idea is appreciated.
>
Well,I look at the code and see some JAXRSClientFactoryBean cache - 
Willem can you comment on this please ? This looks suspicious.
The trace shows that the thread safety is compromised at the point of 
creating web clients. I can work on a patch - though will take me a bit 
of time to get to it

Dumitru - any chance you can declare jaxrs:client or WebClient [1,2] 
explicitly, with a thread safe flag set and reuse it in the routes 
directly ? That should do it.

Thanks
Sergey

[1] 
http://cxf.apache.org/docs/jax-rs-client-api.html#JAX-RSClientAPI-ConfiguringHTTPclientsinSpring
[2] 
http://cxf.apache.org/docs/jax-rs-client-api.html#JAX-RSClientAPI-ConfiguringproxiesinSpring 

[2]

> Best regards,
> Dumitru
>
>
>
> --
> View this message in context: http://camel.465427.n5.nabble.com/CxfRsProducer-is-not-thread-safe-tp5716351.html
> Sent from the Camel - Users mailing list archive at Nabble.com.