On Wed, Nov 23, 2011 at 2:18 PM, majiedahamed
<[email protected]> wrote:
> The camel version is 2.4
>
There could be an issue with that old Camel release.
If you bean has a signature of Exchange as below:
public void doSomething(Exchange exchange) {
Object caught = exchange.getProperty(Exchange.EXCEPTION_CAUGHT);
System.out.println(caught);
}
Then you can see if the caught exception is stored as exchange
property as it should be, to allow you to get access to it.
Upgrading to a newer Camel release should work.
> 1)the original code is
> +++++++++++++++
> <onException useOriginalMessage="true">
>
> <exception>org.apache.camel.processor.validation.SchemaValidationException</exception>
> <exception>org.xml.sax.SAXParseException</exception>
> <exception>org.apache.camel.ValidationException</exception>
>
> <exception>java.lang.Exception</exception>
> <redeliveryPolicy maximumRedeliveries="0" />
> <handled>
> <constant>true</constant>
> </handled>
> <to
> uri="log:xml?
> level=INFO&showException=true&showCaughtException=true&showStackTrace=true"
> />
> <to uri="file:{{retry_loc}}" />
> <to uri="bean:myBean"/>
> </onException>
>
> 2) My class is
>
> public class MyBean {
>
> public void doSomething(Object body, Exception cause) {
> cause.printStackTrace();
> }
>
> }
>
> 3)Bean decleration is <bean id="myBean" class="MyBean"></bean>
>
> Please suggest should i use parameter to the below and try ?
>
> <to uri="bean:myBean?methodName=doSomething"/>
>
>
> --
> View this message in context:
> http://camel.465427.n5.nabble.com/Catch-camel-exception-in-java-code-tp5015714p5016627.html
> Sent from the Camel - Users mailing list archive at Nabble.com.
>
--
Claus Ibsen
-----------------
FuseSource
Email: [email protected]
Web: http://fusesource.com
Twitter: davsclaus, fusenews
Blog: http://davsclaus.blogspot.com/
Author of Camel in Action: http://www.manning.com/ibsen/