Hi,

It seems I have the same issue with Camel 22.15.1.redhat-621159. Did you
find a proper solution?

Just to be more specific, in my case OnException is executed fine if an
exception is thrown in the route, BUT it is not executed in cases when the
Database is down and no transaction can be even created. Which is the same
situation as you are facing.

For example, the NON working stack trace follows. Notice that all start from
a JMS consumer (onMessage) and the exception is thrown when Camel is trying
to create a NEW transaction (doBegin). It does not enter the route logic at
all.

On the other hand, if for example, a RuntimeException is thrown in the Route
(e.g. a validation error I throw under certain conditions), then OnException
is executed and the transaction rolls back successfully.  

*Non working stack trace:*

Caused by: org.springframework.transaction.CannotCreateTransactionException:
Could not open JDBC Connection for transaction; nested exceptio
n is com.mysql.jdbc.exceptions.jdbc4.CommunicationsException: Communications
link failure

The last packet sent successfully to the server was 0 milliseconds ago. The
driver has not received any packets from the server.
        at
org.springframework.jdbc.datasource.DataSourceTransactionManager.doBegin(DataSourceTransactionManager.java:243)[302:org.apache.se
rvicemix.bundles.spring-jdbc:3.2.12.RELEASE_2]
        at
org.springframework.transaction.support.AbstractPlatformTransactionManager.getTransaction(AbstractPlatformTransactionManager.java
:372)[209:org.apache.servicemix.bundles.spring-tx:3.2.12.RELEASE_2]
        at
org.springframework.transaction.support.TransactionTemplate.execute(TransactionTemplate.java:128)[209:org.apache.servicemix.bundl
es.spring-tx:3.2.12.RELEASE_2]
        at
org.apache.camel.spring.spi.TransactionErrorHandler.doInTransactionTemplate(TransactionErrorHandler.java:174)[210:org.apache.came
l.camel-spring:2.15.1.redhat-621159]
        at
org.apache.camel.spring.spi.TransactionErrorHandler.processInTransaction(TransactionErrorHandler.java:134)[210:org.apache.camel.c
amel-spring:2.15.1.redhat-621159]
        at
org.apache.camel.spring.spi.TransactionErrorHandler.process(TransactionErrorHandler.java:103)[210:org.apache.camel.camel-spring:2
.15.1.redhat-621159]
        at
org.apache.camel.spring.spi.TransactionErrorHandler.process(TransactionErrorHandler.java:112)[210:org.apache.camel.camel-spring:2
.15.1.redhat-621159]
        at
org.apache.camel.processor.CamelInternalProcessor.process(CamelInternalProcessor.java:197)[205:org.apache.camel.camel-core:2.15.1
.redhat-621159]
        at
org.apache.camel.processor.CamelInternalProcessor.process(CamelInternalProcessor.java:197)[205:org.apache.camel.camel-core:2.15.1
.redhat-621159]
        at
org.apache.camel.util.AsyncProcessorHelper.process(AsyncProcessorHelper.java:109)[205:org.apache.camel.camel-core:2.15.1.redhat-6
21159]
        at
org.apache.camel.processor.DelegateAsyncProcessor.process(DelegateAsyncProcessor.java:87)[205:org.apache.camel.camel-core:2.15.1.
redhat-621159]
        at
org.apache.camel.component.jms.EndpointMessageListener.onMessage(EndpointMessageListener.java:103)[216:org.apache.camel.camel-jms
:2.15.1.redhat-621159]
        ... 11 more
*
Working stacktrace:*

java.lang.IllegalArgumentException: The mandatory field defined at the
position 17 is empty for the line: 1
        at
org.apache.camel.dataformat.bindy.BindyCsvFactory.bind(BindyCsvFactory.java:188)[222:org.apache.camel.camel-bindy:2.15.1.redhat-6
21159]
        at
org.apache.camel.dataformat.bindy.csv.BindyCsvDataFormat.unmarshal(BindyCsvDataFormat.java:185)[222:org.apache.camel.camel-bindy:
2.15.1.redhat-621159]
        at
org.apache.camel.processor.UnmarshalProcessor.process(UnmarshalProcessor.java:69)[205:org.apache.camel.camel-core:2.15.1.redhat-6
21159]
        at
org.apache.camel.management.InstrumentationProcessor.process(InstrumentationProcessor.java:77)[205:org.apache.camel.camel-core:2.
15.1.redhat-621159]
        at
org.apache.camel.processor.RedeliveryErrorHandler.process(RedeliveryErrorHandler.java:448)[205:org.apache.camel.camel-core:2.15.1
.redhat-621159]
        at
org.apache.camel.util.AsyncProcessorHelper.process(AsyncProcessorHelper.java:109)[205:org.apache.camel.camel-core:2.15.1.redhat-6
21159]
        at
org.apache.camel.processor.RedeliveryErrorHandler.process(RedeliveryErrorHandler.java:329)[205:org.apache.camel.camel-core:2.15.1
.redhat-621159]
        at
org.apache.camel.processor.DefaultErrorHandler.process(DefaultErrorHandler.java:56)[205:org.apache.camel.camel-core:2.15.1.redhat
-621159]
        at
org.apache.camel.processor.CamelInternalProcessor.process(CamelInternalProcessor.java:172)[205:org.apache.camel.camel-core:2.15.1
.redhat-621159]
        at
org.apache.camel.processor.Pipeline.process(Pipeline.java:121)[205:org.apache.camel.camel-core:2.15.1.redhat-621159]
        at
org.apache.camel.processor.Pipeline.process(Pipeline.java:83)[205:org.apache.camel.camel-core:2.15.1.redhat-621159]
        at
org.apache.camel.processor.RedeliveryErrorHandler.process(RedeliveryErrorHandler.java:448)[205:org.apache.camel.camel-core:2.15.1
.redhat-621159]
        at
org.apache.camel.spring.spi.TransactionErrorHandler.processByErrorHandler(TransactionErrorHandler.java:218)[210:org.apache.camel.
camel-spring:2.15.1.redhat-621159]
        at
org.apache.camel.spring.spi.TransactionErrorHandler$1.doInTransactionWithoutResult(TransactionErrorHandler.java:181)[210:org.apac
he.camel.camel-spring:2.15.1.redhat-621159]
        at
org.springframework.transaction.support.TransactionCallbackWithoutResult.doInTransaction(TransactionCallbackWithoutResult.java:33
)[209:org.apache.servicemix.bundles.spring-tx:3.2.12.RELEASE_2]
        at
org.springframework.transaction.support.TransactionTemplate.execute(TransactionTemplate.java:131)[209:org.apache.servicemix.bundl
es.spring-tx:3.2.12.RELEASE_2]
        at
org.apache.camel.spring.spi.TransactionErrorHandler.doInTransactionTemplate(TransactionErrorHandler.java:174)[210:org.apache.came
l.camel-spring:2.15.1.redhat-621159]
        at
org.apache.camel.spring.spi.TransactionErrorHandler.processInTransaction(TransactionErrorHandler.java:134)[210:org.apache.camel.c
amel-spring:2.15.1.redhat-621159]
        at
org.apache.camel.spring.spi.TransactionErrorHandler.process(TransactionErrorHandler.java:103)[210:org.apache.camel.camel-spring:2
.15.1.redhat-621159]
        at
org.apache.camel.spring.spi.TransactionErrorHandler.process(TransactionErrorHandler.java:112)[210:org.apache.camel.camel-spring:2
.15.1.redhat-621159]
        at
org.apache.camel.management.InstrumentationProcessor.process(InstrumentationProcessor.java:77)[205:org.apache.camel.camel-core:2.
15.1.redhat-621159]
        at
org.apache.camel.processor.RedeliveryErrorHandler.process(RedeliveryErrorHandler.java:448)[205:org.apache.camel.camel-core:2.15.1
.redhat-621159]
        at
org.apache.camel.spring.spi.TransactionErrorHandler.processByErrorHandler(TransactionErrorHandler.java:218)[210:org.apache.camel.
camel-spring:2.15.1.redhat-621159]
        at
org.apache.camel.spring.spi.TransactionErrorHandler$1.doInTransactionWithoutResult(TransactionErrorHandler.java:181)[210:org.apac
he.camel.camel-spring:2.15.1.redhat-621159]
        at
org.springframework.transaction.support.TransactionCallbackWithoutResult.doInTransaction(TransactionCallbackWithoutResult.java:33
)[209:org.apache.servicemix.bundles.spring-tx:3.2.12.RELEASE_2]
        at
org.springframework.transaction.support.TransactionTemplate.execute(TransactionTemplate.java:131)[209:org.apache.servicemix.bundl
es.spring-tx:3.2.12.RELEASE_2]
        at
org.apache.camel.spring.spi.TransactionErrorHandler.doInTransactionTemplate(TransactionErrorHandler.java:174)[210:org.apache.came
l.camel-spring:2.15.1.redhat-621159]
        at
org.apache.camel.spring.spi.TransactionErrorHandler.processInTransaction(TransactionErrorHandler.java:134)[210:org.apache.camel.c
amel-spring:2.15.1.redhat-621159]
        at
org.apache.camel.spring.spi.TransactionErrorHandler.process(TransactionErrorHandler.java:103)[210:org.apache.camel.camel-spring:2
.15.1.redhat-621159]
        at
org.apache.camel.spring.spi.TransactionErrorHandler.process(TransactionErrorHandler.java:112)[210:org.apache.camel.camel-spring:2
.15.1.redhat-621159]
        at
org.apache.camel.processor.CamelInternalProcessor.process(CamelInternalProcessor.java:197)[205:org.apache.camel.camel-core:2.15.1
.redhat-621159]
        at
org.apache.camel.processor.CamelInternalProcessor.process(CamelInternalProcessor.java:197)[205:org.apache.camel.camel-core:2.15.1
                
                .redhat-621159]
        at
org.apache.camel.util.AsyncProcessorHelper.process(AsyncProcessorHelper.java:109)[205:org.apache.camel.camel-core:2.15.1.redhat-6
21159]
        at
org.apache.camel.processor.DelegateAsyncProcessor.process(DelegateAsyncProcessor.java:87)[205:org.apache.camel.camel-core:2.15.1.
redhat-621159]
        at
org.apache.camel.component.jms.EndpointMessageListener.onMessage(EndpointMessageListener.java:103)[216:org.apache.camel.camel-jms
:2.15.1.redhat-621159]





--
View this message in context: 
http://camel.465427.n5.nabble.com/Problem-with-exception-handler-onException-on-Camel-2-12-X-routes-tp5742605p5790794.html
Sent from the Camel - Users mailing list archive at Nabble.com.

Reply via email to