Thanks Mary, yes I did separate it from routing logic and it has fixed my 
issue, cheers.

-----Original Message-----
From: Mary Cochran [mailto:[email protected]] 
Sent: Wednesday, 6 September 2017 8:03 AM
To: [email protected]
Subject: Re: exception handling in karaf differs to my test

Have you tried keeping the onException section disconnected from your original 
route and placing it above the route.  So more like this?

onException(SoapFault.class).handled(true)
     .process(new Processor() {
            @Override
            public void process(Exchange exchange) throws Exception {
                Exception e = exchange.getProperty("CamelExceptionCaught",
Exception.class);
                if (e.getMessage().contains("TimesheetAlreadyExistsException"))
{
                    logger.info("Handling TimesheetAlreadyExistsException");
                    exchange.getIn().removeHeader("operationName");
                    exchange.getIn().setHeader("operationName", "update");
                    ProducerTemplate template = getContext().
createProducerTemplate();
                    template.send("remote-service-paymenttimesheet",
exchange);
                }else
                    throw new RuntimeException(e);
            }
        })

from(blah)
    .to(toEndpoint);


Mary Cochran
Red Hat Consulting
[email protected]
(419) 543-0531

On Tue, Aug 29, 2017 at 12:25 AM, Matthew Shaw < 
[email protected]> wrote:

> Hi All,
>
> I have a strange error. I am using camel 2.20.1 and I have a test 
> working perfectly for a route which uses onException to handle a known 
> exception from invoking a web service. However, if I deploy this into 
> apache karaf, the onException handler never gets entered into. I am 
> running cxf 3.x in karaf via the camel-cxf feature.
>
> Here is my error handler
> .to(toEndpoint)
>     .onException(SoapFault.class).continued(true)
>         .process(new Processor() {
>             @Override
>             public void process(Exchange exchange) throws Exception {
>                 Exception e = 
> exchange.getProperty("CamelExceptionCaught",
> Exception.class);
>                 if (e.getMessage().contains("
> TimesheetAlreadyExistsException")) {
>                     logger.info("Handling 
> TimesheetAlreadyExistsExceptio n");
>                     exchange.getIn().removeHeader("operationName");
>                     exchange.getIn().setHeader("operationName", "update");
>                     ProducerTemplate template = getContext().
> createProducerTemplate();
>                     template.send("remote-service-paymenttimesheet",
> exchange);
>                 }else
>                     throw new RuntimeException(e);
>             }
>         })
>
>
> Any ideas?
>
> Cheers,
> Matt.
> This email, including any attachments sent with it, is confidential 
> and for the sole use of the intended recipient(s). This 
> confidentiality is not waived or lost, if you receive it and you are 
> not the intended recipient(s), or if it is transmitted/received in error.
>
> Any unauthorised use, alteration, disclosure, distribution or review 
> of this email is strictly prohibited. The information contained in 
> this email, including any attachment sent with it, may be subject to a 
> statutory duty of confidentiality if it relates to health service matters.
>
> If you are not the intended recipient(s), or if you have received this 
> email in error, you are asked to immediately notify the sender. You 
> should also delete this email, and any copies, from your computer 
> system network and destroy any hard copies produced.
>
> If not an intended recipient of this email, you must not copy, 
> distribute or take any action(s) that relies on it; any form of 
> disclosure, modification, distribution and/or publication of this 
> email is also prohibited.
>
> Although the Queensland Ambulance Service takes all reasonable steps 
> to ensure this email does not contain malicious software, the 
> Queensland Ambulance Service does not accept responsibility for the 
> consequences if any person's computer inadvertently suffers any 
> disruption to services, loss of information, harm or is infected with 
> a virus, other malicious computer programme or code that may occur as 
> a consequence of receiving this email.
>
> Unless stated otherwise, this email represents only the views of the 
> sender and not the views of the Queensland Government.
>
> ************************************************************
> ********************
>
> The content presented in this publication is distributed by the 
> Queensland Government as an information source only. The State of 
> Queensland makes no statements, representations or warranties about 
> the accuracy, completeness or reliability of any information contained 
> in this publication. The State of Queensland disclaims all 
> responsibility and all liability (including without limitation for 
> liability in negligence) for all expenses, losses, damages and costs 
> you might incur as a result of the information being inaccurate or 
> incomplete in any way, and for any reason reliance was placed on such 
> information.
>
This email, including any attachments sent with it, is confidential and for the 
sole use of the intended recipient(s). This confidentiality is not waived or 
lost, if you receive it and you are not the intended recipient(s), or if it is 
transmitted/received in error.

Any unauthorised use, alteration, disclosure, distribution or review of this 
email is strictly prohibited. The information contained in this email, 
including any attachment sent with it, may be subject to a statutory duty of 
confidentiality if it relates to health service matters.

If you are not the intended recipient(s), or if you have received this email in 
error, you are asked to immediately notify the sender. You should also delete 
this email, and any copies, from your computer system network and destroy any 
hard copies produced.

If not an intended recipient of this email, you must not copy, distribute or 
take any action(s) that relies on it; any form of disclosure, modification, 
distribution and/or publication of this email is also prohibited.

Although the Queensland Ambulance Service takes all reasonable steps to ensure 
this email does not contain malicious software, the Queensland Ambulance 
Service does not accept responsibility for the consequences if any person's 
computer inadvertently suffers any disruption to services, loss of information, 
harm or is infected with a virus, other malicious computer programme or code 
that may occur as a consequence of receiving this email.

Unless stated otherwise, this email represents only the views of the sender and 
not the views of the Queensland Government.

********************************************************************************

The content presented in this publication is distributed by the Queensland 
Government as an information source only. The State of Queensland makes no 
statements, representations or warranties about the accuracy, completeness or 
reliability of any information contained in this publication. The State of 
Queensland disclaims all responsibility and all liability (including without 
limitation for liability in negligence) for all expenses, losses, damages and 
costs you might incur as a result of the information being inaccurate or 
incomplete in any way, and for any reason reliance was placed on such 
information.

Reply via email to