Hi, Can you just remove the <transacted/> tag to see if message is printed out ?
<transacted> will set up a new TransactionErrorHandler if I remember right. Willem dnn wrote:
I am trying to use global onException handling with a transacted route. According to the everything I've read, the following should print the "HEY IGOT AN EXCEPTION" message: <camelContext errorHandlerRef="myErrorHandler"> <onException> <exception>java.lang.Exception</exception> <log loggingLevel="ERROR" message="HEY I GOT AN EXCEPTION" /> </onException> <route> <from uri="jms:test" /> <transacted /> <to uri="someProcessorThatThrowsAnException" /> </route> </camelContext> <bean id="myErrorHandler"class="org.apache.camel.spring.spi.TransactionErrorHandlerBuilder"> <property name="transactionTemplate"ref="PROPAGATION_REQUIRES_NEW_TEMPLATE" /> </bean> <bean id="PROPAGATION_REQUIRES_NEW_TEMPLATE" class="org.springframework.transaction.support.TransactionTemplate"> <property name="transactionManager" ref="transactionManager" /> <property name="propagationBehaviorName" value="PROPAGATION_REQUIRES_NEW" /> </bean> I would imagine that when "someProcessorThatThrowsAnException" is executed, it will throw an exception that is handled by the global onException handler. However, it doesn't work and my log message is never printed out. I have found a workaround by moving the onException handling INSIDE the <transacted></transacted> block as such: <camelContext errorHandlerRef="myErrorHandler"> <route> <from uri="jms:test" /> <transacted> <onException> <exception>java.lang.Exception</exception> <log loggingLevel="ERROR" message="HEY I GOT AN EXCEPTION" /> </onException> <to uri="someProcessorThatThrowsAnException" /> </transacted> </route> </camelContext> It appears that the <transacted></transacted> block is creating its own try/catch block that is ignorant of the global onException handler. Is this the expected behavior? Is there any way to make it act like my first example? I would prefer using the global onException route to share it among several routes. I am using Camel 2.2.0. Thanks, Dan Nawrocki
