camel-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jguerra <jg.gue...@gmail.com>
Subject Re: Problem with exception handler (onException) on Camel 2.12.X routes.
Date Tue, 21 Jan 2014 13:02:55 GMT
Hi 

I've just tested the route following two scenarios and I as far I can see,
the handler works but only when the <transacted/> instruction is removed
from the route.

I wrote down a test bean "testBean" which it throws an exception and I
tested that the route below works and the exceptions are caught. Okay, so
far so good!!!

<route id="ntcs">
                <description>NTCS Oracle Insertion Queue</description>
                <from uri="seda:insertion.queue"/>
                <onException>
                        <exception>java.lang.Exception</exception>
                        <handled>
                                <constant>true</constant>
                        </handled>
                </onException>
		<split shareUnitOfWork="true">
                        <xpath>/ntcs-telemetry/telemetry</xpath>
                        <bean ref="testBean"/>
                </split>
        </route>


However, the same bean but adding <transacted/> to the route, it doesn't
work!

<route id="ntcs">
                <description>NTCS Oracle Insertion Queue</description>
                <from uri="seda:insertion.queue"/>
		
                <onException>
                        <exception>java.lang.Exception</exception>
                        <handled>
                                <constant>true</constant>
                        </handled>
                </onException>
                <transacted/>
		<split shareUnitOfWork="true">
                        <xpath>/ntcs-telemetry/telemetry</xpath>
                        <bean ref="testBean"/>
                </split>
        </route>

2014-01-21 12:45:40,742 | DEBUG | >>>> Endpoint[seda://insertion.queue]
Exchange[JmsMessage[JmsMessageID:
ID:tcs-amq-dev.tng.iac.es-33391-1390308307346-5:1:1:1:1]] |
org.apache.camel.processor.SendProcessor | Camel (camel) thread #0 -
JmsConsumer[ntcs.telemetry.in]
2014-01-21 12:45:40,750 | DEBUG | Transaction begin (0x27d21)
redelivered(false) for (MessageId:
queue_ntcs.telemetry.in_ID_tcs-amq-dev.tng.iac.es-33391-1390308307346-5_1_1_1_1
on ExchangeId: ID-tcs-amq-dev-tng-iac-es-41173-1390308309189-0-2)) |
org.apache.camel.spring.spi.TransactionErrorHandler | Camel (camel) thread
#1 - seda://insertion.queue
2014-01-21 12:45:40,754 | DEBUG | Creating new transaction with name [null]:
PROPAGATION_REQUIRED,ISOLATION_DEFAULT |
org.springframework.jdbc.datasource.DataSourceTransactionManager | Camel
(camel) thread #1 - seda://insertion.queue
2014-01-21 12:45:41,093 | WARN  | Transaction rollback (0x27d21)
redelivered(false) for (MessageId:
queue_ntcs.telemetry.in_ID_tcs-amq-dev.tng.iac.es-33391-1390308307346-5_1_1_1_1
on ExchangeId: ID-tcs-amq-dev-tng-iac-es-41173-1390308309189-0-2) caught:
Could not open JDBC Connection for transaction; nested exception is
java.sql.SQLException: Unable to start the Universal Connection Pool:
oracle.ucp.UniversalConnectionPoolException: Cannot get Connection from
Datasource: java.sql.SQLRecoverableException: IO Error: The Network Adapter
could not establish the connection |
org.apache.camel.spring.spi.TransactionErrorHandler | Camel (camel) thread
#1 - seda://insertion.queue
2014-01-21 12:45:41,094 | WARN  | Error processing exchange.
Exchange[JmsMessage[JmsMessageID:
ID:tcs-amq-dev.tng.iac.es-33391-1390308307346-5:1:1:1:1]]. Caused by:
[org.springframework.transaction.CannotCreateTransactionException - Could
not open JDBC Connection for transaction; nested exception is
java.sql.SQLException: Unable to start the Universal Connection Pool:
oracle.ucp.UniversalConnectionPoolException: Cannot get Connection from
Datasource: java.sql.SQLRecoverableException: IO Error: The Network Adapter
could not establish the connection] |
org.apache.camel.component.seda.SedaConsumer | Camel (camel) thread #1 -
seda://insertion.queue
org.springframework.transaction.CannotCreateTransactionException: Could not
open JDBC Connection for transaction; nested exception is
java.sql.SQLException: Unable to start the Universal Connection Pool:
oracle.ucp.UniversalConnectionPoolException: Cannot get Connection from
Datasource: java.sql.SQLRecoverableException: IO Error: The Network Adapter
could not establish the connection
        at
org.springframework.jdbc.datasource.DataSourceTransactionManager.doBegin(DataSourceTransactionManager.java:241)
        at
org.springframework.transaction.support.AbstractPlatformTransactionManager.getTransaction(AbstractPlatformTransactionManager.java:372)
        at
org.springframework.transaction.support.TransactionTemplate.execute(TransactionTemplate.java:128)
        at
org.apache.camel.spring.spi.TransactionErrorHandler.doInTransactionTemplate(TransactionErrorHandler.java:174)
        at
org.apache.camel.spring.spi.TransactionErrorHandler.processInTransaction(TransactionErrorHandler.java:134)
        at
org.apache.camel.spring.spi.TransactionErrorHandler.process(TransactionErrorHandler.java:103)
        at
org.apache.camel.spring.spi.TransactionErrorHandler.process(TransactionErrorHandler.java:112)
        at
org.apache.camel.processor.CamelInternalProcessor.process(CamelInternalProcessor.java:191)
        at
org.apache.camel.processor.CamelInternalProcessor.process(CamelInternalProcessor.java:191)
        at
org.apache.camel.component.seda.SedaConsumer.sendToConsumers(SedaConsumer.java:291)
        at
org.apache.camel.component.seda.SedaConsumer.doRun(SedaConsumer.java:200)
        at
org.apache.camel.component.seda.SedaConsumer.run(SedaConsumer.java:147)
        at
java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
        at
java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
        at java.lang.Thread.run(Thread.java:744)
Caused by: java.sql.SQLException: Unable to start the Universal Connection
Pool: oracle.ucp.UniversalConnectionPoolException: Cannot get Connection
from Datasource: java.sql.SQLRecoverableException: IO Error: The Network
Adapter could not establish the connection
        at
oracle.ucp.util.UCPErrorHandler.newSQLException(UCPErrorHandler.java:488)
        at
oracle.ucp.util.UCPErrorHandler.throwSQLException(UCPErrorHandler.java:163)
        at
oracle.ucp.jdbc.PoolDataSourceImpl.startPool(PoolDataSourceImpl.java:643)
        at
oracle.ucp.jdbc.PoolDataSourceImpl.getConnection(PoolDataSourceImpl.java:878)
        at
oracle.ucp.jdbc.PoolDataSourceImpl.getConnection(PoolDataSourceImpl.java:845)
        at
oracle.ucp.jdbc.PoolDataSourceImpl.getConnection(PoolDataSourceImpl.java:839)
        at
org.springframework.jdbc.datasource.DataSourceTransactionManager.doBegin(DataSourceTransactionManager.java:203)
        ... 14 more
Caused by: oracle.ucp.UniversalConnectionPoolException: Cannot get
Connection from Datasource: java.sql.SQLRecoverableException: IO Error: The
Network Adapter could not establish the connection
        at
oracle.ucp.util.UCPErrorHandler.newUniversalConnectionPoolException(UCPErrorHandler.java:368)
        at
oracle.ucp.util.UCPErrorHandler.throwUniversalConnectionPoolException(UCPErrorHandler.java:49)
        at
oracle.ucp.util.UCPErrorHandler.throwUniversalConnectionPoolException(UCPErrorHandler.java:80)
        at
oracle.ucp.jdbc.DataSourceConnectionFactoryAdapter.createConnection(DataSourceConnectionFactoryAdapter.java:102)
        at
oracle.ucp.common.UniversalConnectionPoolImpl$UniversalConnectionPoolInternal.createOnePooledConnectionInternal(UniversalConnectionPoolImpl.java:1584)
        at
oracle.ucp.common.UniversalConnectionPoolImpl$UniversalConnectionPoolInternal.access$600(UniversalConnectionPoolImpl.java:1420)
        at
oracle.ucp.common.UniversalConnectionPoolImpl.createOnePooledConnection(UniversalConnectionPoolImpl.java:498)
        at
oracle.ucp.jdbc.oracle.OracleJDBCConnectionPool.createOnePooledConnection(OracleJDBCConnectionPool.java:127)
:


So, please, I encourage you to test a transacted route instead to see
whether you can reproduce the problem. Just bear in mind that this scenario
works on Camel 2.7.0 for me.



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

Mime
View raw message