camel-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Cristiano Costantini <>
Subject Extracting the 'cause' from org.apache.camel.RuntimeCamelException
Date Tue, 15 Mar 2016 17:25:18 GMT
Hello All,

I need to throw an "Fault" to a CXF service which is managed via a

The fault exception is generated in a Bean, but the camel route wrap it in
org.apache.camel.RuntimeCamelException and when it is sent back to the
initial CXF endpoint it is not marshalled properly as CXF expects a Jax-WS

The only solution that I've found is to extract the cause and set it as the
... but I don't like this solution, it seems fragile to me. Do you have any
suggestion on how best to handle this use-case?

Below a follow a more detailed example:

consider the following Bean:
<bean id="myBean" class="net.cristcost.MyBean" />

I'm able to publish it as a Web Service with CXF in this way:
<jaxws:endpoint id="directCxfService" implementor="#myBean"

Now I need to some kind of processing between the request and the handling
by the bean, so I introduce Camel:

<cxf:cxfEndpoint id="serviceViaCamel"

and a route like this

<from uri="cxf:bean:serviceViaCamel" />
<!-- pre processing,filtering and routing of the requests here -->
<to uri="bean:myBean" />

The problem happen when the service bean throws the exception. My solution
has been to handle the exception specifically by extracting the cause in
the following way:

<camelContext id="camelContext" xmlns="


<from uri="cxf:bean:serviceViaCamel" />
<!-- pre processing of the requests happen here -->
<to uri="bean:myBean" />

Could you suggest a more elegant solution to do this?
Thank you!


  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message