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+s465427n5716752...@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.

Reply via email to