Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6110823
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T14:33:36+00:00 2026-05-23T14:33:36+00:00

I am trying to route a rest request from a cxf rest service to

  • 0

I am trying to route a rest request from a cxf rest service to another. I have had a look at http://camel.apache.org/cxfrs.html which helped understand part of the process. I have a classCastException at the level of the remoteService Invocation.

What am I doing wrong ?

<cxf:rsServer id="exposedService" address="/exposed/"
serviceClass="com.example.project.ExposedService" />

<!-- using different classes since we are not just proxying -->
<cxf:rsClient id="remoteService" address="http://remote.com/service"
serviceClass="com.example.project.RemoteService" />

<camel:camelContext xmlns="http://camel.apache.org/schema/spring">
   <package>com.example.project</package>
</camel:camelContext>

Service Classes:

@Path("/myservice")
public class ExposedService {

    @POST
        @Consumes("application/xml")
    public void postResource(javax.xml.transform.Source resource) {
            // source : not using jaxb just plain xml
        // only serves to configure the endpoint (?)    
    }               
}


public class RemoteService {

    @POST
        @Consumes("application/xml")
    public void postResource(javax.xml.transform.Source resource) {
            // source : not using jaxb just plain xml
        // only serves to configure the endpoint (?)    
    }               
}

RouteBuilder:

public class MyRouteBuilder extends RouteBuilder {

public void configure() { 
    from("cxfrs://bean://exposedService")
    .process(...) // a few System.out.println's
    .to("cxfrs://bean://remoteService")
    ;   
}
}

Stacktrace:

| ERROR | qtp-2045010446-1 | DefaultErrorHandler              | 68 - org.apache.camel.camel-core - 2.6.0 | Failed delivery for exchangeId: ID-Lab-local-52879-1305561896560-7-2. Exhausted after delivery attempt: 1 caught: java.lang.ClassCastException
java.lang.ClassCastException
        at java.lang.Class.cast(Class.java:2990)[:1.6.0_24]
        at org.apache.cxf.jaxrs.client.WebClient.invoke(WebClient.java:329)[116:org.apache.cxf.bundle:2.3.2]
        at org.apache.camel.component.cxf.jaxrs.CxfRsProducer.invokeHttpClient(CxfRsProducer.java:147)[118:org.apache.camel.camel-cxf:2.6.0]
        at org.apache.camel.component.cxf.jaxrs.CxfRsProducer.process(CxfRsProducer.java:77)[118:org.apache.camel.camel-cxf:2.6.0]
        at org.apache.camel.impl.converter.AsyncProcessorTypeConverter$ProcessorToAsyncProcessorBridge.process(AsyncProcessorTypeConverter.java:50)[68:org.apache.camel.camel-core:2.6.0]
        at org.apache.camel.util.AsyncProcessorHelper.process(AsyncProcessorHelper.java:70)[68:org.apache.camel.camel-core:2.6.0]
        at org.apache.camel.processor.SendProcessor$2.doInAsyncProducer(SendProcessor.java:104)[68:org.apache.camel.camel-core:2.6.0]
        at org.apache.camel.impl.ProducerCache.doInAsyncProducer(ProducerCache.java:272)[68:org.apache.camel.camel-core:2.6.0]
        at org.apache.camel.processor.SendProcessor.process(SendProcessor.java:98)[68:org.apache.camel.camel-core:2.6.0]
        at org.apache.camel.util.AsyncProcessorHelper.process(AsyncProcessorHelper.java:70)[68:org.apache.camel.camel-core:2.6.0]
        at org.apache.camel.processor.DelegateAsyncProcessor.processNext(DelegateAsyncProcessor.java:98)[68:org.apache.camel.camel-core:2.6.0]
        at org.apache.camel.processor.DelegateAsyncProcessor.process(DelegateAsyncProcessor.java:89)[68:org.apache.camel.camel-core:2.6.0]
        at org.apache.camel.management.InstrumentationProcessor.process(InstrumentationProcessor.java:68)[68:org.apache.camel.camel-core:2.6.0]
        at org.apache.camel.util.AsyncProcessorHelper.process(AsyncProcessorHelper.java:70)[68:org.apache.camel.camel-core:2.6.0]
        at org.apache.camel.processor.DelegateAsyncProcessor.processNext(DelegateAsyncProcessor.java:98)[68:org.apache.camel.camel-core:2.6.0]
        at org.apache.camel.processor.DelegateAsyncProcessor.process(DelegateAsyncProcessor.java:89)[68:org.apache.camel.camel-core:2.6.0]
        at org.apache.camel.processor.interceptor.TraceInterceptor.process(TraceInterceptor.java:174)[68:org.apache.camel.camel-core:2.6.0]
        at org.apache.camel.util.AsyncProcessorHelper.process(AsyncProcessorHelper.java:70)[68:org.apache.camel.camel-core:2.6.0]
        at org.apache.camel.processor.RedeliveryErrorHandler.processErrorHandler(RedeliveryErrorHandler.java:299)[68:org.apache.camel.camel-core:2.6.0]
        at org.apache.camel.processor.RedeliveryErrorHandler.process(RedeliveryErrorHandler.java:208)[68:org.apache.camel.camel-core:2.6.0]
        at org.apache.camel.processor.DefaultChannel.process(DefaultChannel.java:269)[68:org.apache.camel.camel-core:2.6.0]
        at org.apache.camel.util.AsyncProcessorHelper.process(AsyncProcessorHelper.java:70)[68:org.apache.camel.camel-core:2.6.0]
        at org.apache.camel.processor.Pipeline.process(Pipeline.java:125)[68:org.apache.camel.camel-core:2.6.0]
        at org.apache.camel.processor.Pipeline.process(Pipeline.java:80)[68:org.apache.camel.camel-core:2.6.0]
        at org.apache.camel.processor.UnitOfWorkProcessor.process(UnitOfWorkProcessor.java:102)[68:org.apache.camel.camel-core:2.6.0]
        at org.apache.camel.util.AsyncProcessorHelper.process(AsyncProcessorHelper.java:70)[68:org.apache.camel.camel-core:2.6.0]
        at org.apache.camel.processor.DelegateAsyncProcessor.processNext(DelegateAsyncProcessor.java:98)[68:org.apache.camel.camel-core:2.6.0]
        at org.apache.camel.processor.DelegateAsyncProcessor.process(DelegateAsyncProcessor.java:89)[68:org.apache.camel.camel-core:2.6.0]
        at org.apache.camel.management.InstrumentationProcessor.process(InstrumentationProcessor.java:68)[68:org.apache.camel.camel-core:2.6.0]
        at org.apache.camel.util.AsyncProcessorHelper.process(AsyncProcessorHelper.java:91)[68:org.apache.camel.camel-core:2.6.0]
        at org.apache.camel.processor.DelegateAsyncProcessor.process(DelegateAsyncProcessor.java:85)[68:org.apache.camel.camel-core:2.6.0]
        at org.apache.camel.component.cxf.jaxrs.CxfRsInvoker.syncInvoke(CxfRsInvoker.java:134)[118:org.apache.camel.camel-cxf:2.6.0]
        at org.apache.camel.component.cxf.jaxrs.CxfRsInvoker.performInvocation(CxfRsInvoker.java:68)[118:org.apache.camel.camel-cxf:2.6.0]
        at org.apache.cxf.service.invoker.AbstractInvoker.invoke(AbstractInvoker.java:89)[116:org.apache.cxf.bundle:2.3.2]
        at org.apache.cxf.jaxrs.JAXRSInvoker.invoke(JAXRSInvoker.java:153)[116:org.apache.cxf.bundle:2.3.2]
        at org.apache.cxf.jaxrs.JAXRSInvoker.invoke(JAXRSInvoker.java:87)[116:org.apache.cxf.bundle:2.3.2]
        at org.apache.cxf.interceptor.ServiceInvokerInterceptor$1.run(ServiceInvokerInterceptor.java:58)[116:org.apache.cxf.bundle:2.3.2]
        at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:441)[:1.6.0_24]
        at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:303)[:1.6.0_24]
        at java.util.concurrent.FutureTask.run(FutureTask.java:138)[:1.6.0_24]
        at org.apache.cxf.workqueue.SynchronousExecutor.execute(SynchronousExecutor.java:37)[116:org.apache.cxf.bundle:2.3.2]
        at org.apache.cxf.interceptor.ServiceInvokerInterceptor.handleMessage(ServiceInvokerInterceptor.java:106)[116:org.apache.cxf.bundle:2.3.2]
        at org.apache.cxf.phase.PhaseInterceptorChain.doIntercept(PhaseInterceptorChain.java:255)[116:org.apache.cxf.bundle:2.3.2]
        at org.apache.cxf.transport.ChainInitiationObserver.onMessage(ChainInitiationObserver.java:113)[116:org.apache.cxf.bundle:2.3.2]
        at org.apache.cxf.transport.http_osgi.OsgiDestination.doMessage(OsgiDestination.java:79)[116:org.apache.cxf.bundle:2.3.2]
        at org.apache.cxf.transport.http_osgi.OsgiServletController.invokeDestination(OsgiServletController.java:336)[116:org.apache.cxf.bundle:2.3.2]
        at org.apache.cxf.transport.http_osgi.OsgiServletController.invoke(OsgiServletController.java:108)[116:org.apache.cxf.bundle:2.3.2]
        at org.apache.cxf.transport.http_osgi.OsgiServlet.invoke(OsgiServlet.java:53)[116:org.apache.cxf.bundle:2.3.2]
        at org.apache.cxf.transport.http_osgi.SpringOsgiServlet.invoke(SpringOsgiServlet.java:48)[116:org.apache.cxf.bundle:2.3.2]
        at org.apache.cxf.transport.servlet.AbstractHTTPServlet.handleRequest(AbstractHTTPServlet.java:179)[116:org.apache.cxf.bundle:2.3.2]
        at org.apache.cxf.transport.servlet.AbstractHTTPServlet.doPost(AbstractHTTPServlet.java:103)[116:org.apache.cxf.bundle:2.3.2]
        at javax.servlet.http.HttpServlet.service(HttpServlet.java:595)[93:org.apache.geronimo.specs.geronimo-servlet_3.0_spec:1.0]
        at org.apache.cxf.transport.servlet.AbstractHTTPServlet.service(AbstractHTTPServlet.java:159)[116:org.apache.cxf.bundle:2.3.2]
        at org.mortbay.jetty.servlet.ServletHolder.handle(ServletHolder.java:511)[94:org.apache.servicemix.bundles.jetty:6.1.25.1]
        at org.mortbay.jetty.servlet.ServletHandler.handle(ServletHandler.java:390)[94:org.apache.servicemix.bundles.jetty:6.1.25.1]
        at org.ops4j.pax.web.service.jetty.internal.HttpServiceServletHandler.handle(HttpServiceServletHandler.java:64)[133:org.ops4j.pax.web.pax-web-jetty:0.7.4]
        at org.mortbay.jetty.servlet.SessionHandler.handle(SessionHandler.java:182)[94:org.apache.servicemix.bundles.jetty:6.1.25.1]
        at org.mortbay.jetty.handler.ContextHandler.handle(ContextHandler.java:765)[94:org.apache.servicemix.bundles.jetty:6.1.25.1]
        at org.ops4j.pax.web.service.jetty.internal.HttpServiceContext.handle(HttpServiceContext.java:111)[133:org.ops4j.pax.web.pax-web-jetty:0.7.4]
        at org.ops4j.pax.web.service.jetty.internal.JettyServerHandlerCollection.handle(JettyServerHandlerCollection.java:68)[133:org.ops4j.pax.web.pax-web-jetty:0.7.4]
        at org.mortbay.jetty.handler.HandlerWrapper.handle(HandlerWrapper.java:152)[94:org.apache.servicemix.bundles.jetty:6.1.25.1]
        at org.mortbay.jetty.Server.handle(Server.java:326)[94:org.apache.servicemix.bundles.jetty:6.1.25.1]
        at org.mortbay.jetty.HttpConnection.handleRequest(HttpConnection.java:542)[94:org.apache.servicemix.bundles.jetty:6.1.25.1]
        at org.mortbay.jetty.HttpConnection$RequestHandler.content(HttpConnection.java:943)[94:org.apache.servicemix.bundles.jetty:6.1.25.1]
        at org.mortbay.jetty.HttpParser.parseNext(HttpParser.java:756)[94:org.apache.servicemix.bundles.jetty:6.1.25.1]
        at org.mortbay.jetty.HttpParser.parseAvailable(HttpParser.java:218)[94:org.apache.servicemix.bundles.jetty:6.1.25.1]
        at org.mortbay.jetty.HttpConnection.handle(HttpConnection.java:404)[94:org.apache.servicemix.bundles.jetty:6.1.25.1]
        at org.mortbay.io.nio.SelectChannelEndPoint.run(SelectChannelEndPoint.java:410)[94:org.apache.servicemix.bundles.jetty:6.1.25.1]
        at org.mortbay.thread.QueuedThreadPool$PoolThread.run(QueuedThreadPool.java:582)[94:org.apache.servicemix.bundles.jetty:6.1.25.1]
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-23T14:33:36+00:00Added an answer on May 23, 2026 at 2:33 pm

    there is a working example of doing nearly the same thing here…

    http://camel.apache.org/cxf-proxy-example.html

    start with this, then drop your changes in one-by-one and see where it breaks…

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a WCF/REST Web Service that I'm trying to add a global exception
I am trying to integrate my CXF restful webservices with apache camel. the requirement
trying to use this route: from(activemq:profiles).aggregate(header(cheese)).batchSize(30).bean(ProfilesQueueService, saveContacts) Fails with: No signature of method: org.apache.camel.model.RouteType.aggregate()
I'm trying to draw a route in a mapView from the current location (got
I am trying to edit a record. I have the default route. When I
I'm trying to create a Route in Cakephp that can have anything as a
I m trying to achive route like that: http://mysite.com/portfolio/landscape http://mysite.com/portfolio/friends etc... so I wrote
I am trying to make a simple REST Service with .NET 4.0 that uses
I'm trying to route a path like this: http://www.wikipediamaze.com/wiki/Washington,_D.C. The routing framework is not
I'm using WCF REST service with API key template and trying to enforce validation

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.