You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@camel.apache.org by jguerra <jg...@gmail.com> on 2013/12/10 14:00:40 UTC

Re: Problem with exception handler (onException) on Camel 2.12.X routes.

Hi,
I switched </transaced> and <onException> with no luck!. Camel still doesn't
catch any exception. I am tried with java.lang.Exception and
java.sql.SQLException. The funniest part is that it works with older
versions !





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

Re: Problem with exception handler (onException) on Camel 2.12.X routes.

Posted by jguerra <jg...@gmail.com>.
Hi,

I am pretty much inclined to say that the transacted routes the exception
handler doesn't work. I am not sure whether anybody else has checked this
out. Apparently no transacted routes, the handler works fine.



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

Re: Problem with exception handler (onException) on Camel 2.12.X routes.

Posted by jguerra <jg...@gmail.com>.
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.

Re: Problem with exception handler (onException) on Camel 2.12.X routes.

Posted by jguerra <jg...@gmail.com>.
okay, you mean the log4j appender I guess. So far what I have is this

log4j.rootLogger=INFO, console, logfile
log4j.logger.org.apache.activemq.spring=WARN
log4j.logger.org.apache.activemq.web.handler=WARN
log4j.logger.org.springframework=WARN
log4j.logger.org.apache.xbean=WARN
log4j.logger.org.apache.camel=DEBUG
log4j.logger.org.eclipse.jetty=WARN

if you have any other suggestion for the logging thing, Please let me know
it.




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

Re: Problem with exception handler (onException) on Camel 2.12.X routes.

Posted by "kraythe ." <kr...@gmail.com>.
Uhh probably not. Proprietary code you know. I would look for another
problem. I know the exception handlers are working fine so if you say you
are getting an exception without even the processor in the route, its time
to turn the tracer to max and pretend you are the computer. Something weird
is going on there.

*Robert Simmons Jr. MSc. - Lead Java Architect @ EA*
*Author of: Hardcore Java (2003) and Maintainable Java (2012)*
*LinkedIn: **http://www.linkedin.com/pub/robert-simmons/40/852/a39
<http://www.linkedin.com/pub/robert-simmons/40/852/a39>*


On Mon, Dec 23, 2013 at 4:51 AM, jguerra <jg...@gmail.com> wrote:

> Good news.... Please could you provide more information about the scenarios
> you test?. Did you handle java.sql.SQLException?. What kind of environment
> did you test it.?. Could you please attach the whole dependency tree
> running
> in your tests for your handlers (Database, Spring, etc...)?
>
>
>
>
>
> --
> View this message in context:
> http://camel.465427.n5.nabble.com/Problem-with-exception-handler-onException-on-Camel-2-12-X-routes-tp5742605p5745185.html
> Sent from the Camel - Users mailing list archive at Nabble.com.
>

Re: Problem with exception handler (onException) on Camel 2.12.X routes.

Posted by jguerra <jg...@gmail.com>.
Good news.... Please could you provide more information about the scenarios
you test?. Did you handle java.sql.SQLException?. What kind of environment
did you test it.?. Could you please attach the whole dependency tree running
in your tests for your handlers (Database, Spring, etc...)?





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

Re: Problem with exception handler (onException) on Camel 2.12.X routes.

Posted by "kraythe ." <kr...@gmail.com>.
I have no idea beyond what I told you I am afraid. I use exception handlers
extensively in 2.12 routes and they work great.

*Robert Simmons Jr. MSc. - Lead Java Architect @ EA*
*Author of: Hardcore Java (2003) and Maintainable Java (2012)*
*LinkedIn: **http://www.linkedin.com/pub/robert-simmons/40/852/a39
<http://www.linkedin.com/pub/robert-simmons/40/852/a39>*


On Tue, Dec 17, 2013 at 5:52 AM, jguerra <jg...@gmail.com> wrote:

> Thank you,
> The only thing i can say is that this camel.xml file works on Camel 2.7.0
> nicely. All the scenarios work as they meant to be. On camel 2.12.X the
> exceptions seem not working, the other scenarios work though and the route
> insert data into the database okay
>
>
>
> --
> View this message in context:
> http://camel.465427.n5.nabble.com/Problem-with-exception-handler-onException-on-Camel-2-12-X-routes-tp5742605p5744942.html
> Sent from the Camel - Users mailing list archive at Nabble.com.
>

Re: Problem with exception handler (onException) on Camel 2.12.X routes.

Posted by jguerra <jg...@gmail.com>.
Thank you,
The only thing i can say is that this camel.xml file works on Camel 2.7.0
nicely. All the scenarios work as they meant to be. On camel 2.12.X the
exceptions seem not working, the other scenarios work though and the route
insert data into the database okay



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

Re: Problem with exception handler (onException) on Camel 2.12.X routes.

Posted by "kraythe ." <kr...@gmail.com>.
I would try to create a unit test using CamelTestSupport and see if i could
reproduce the issue before going further.

*Robert Simmons Jr. MSc. - Lead Java Architect @ EA*
*Author of: Hardcore Java (2003) and Maintainable Java (2012)*
*LinkedIn: **http://www.linkedin.com/pub/robert-simmons/40/852/a39
<http://www.linkedin.com/pub/robert-simmons/40/852/a39>*


On Wed, Dec 11, 2013 at 11:25 AM, jguerra <jg...@gmail.com> wrote:

> Yes, you are right as far I can see. it's correct that there is a double
> exception inside of the telemetryFailureProcessor when the message is not
> valid **but** when the message is valid, the exception still comes up!.
> Even
> though the processor is removed from the route, the java.sql.SQLException
> is
> not being caught. My hunch is that the exceptions are not even caught by
> the
> onException handler!.
>
>
>
> --
> View this message in context:
> http://camel.465427.n5.nabble.com/Problem-with-exception-handler-onException-on-Camel-2-12-X-routes-tp5742605p5744626.html
> Sent from the Camel - Users mailing list archive at Nabble.com.
>

Re: Problem with exception handler (onException) on Camel 2.12.X routes.

Posted by jguerra <jg...@gmail.com>.
Yes, you are right as far I can see. it's correct that there is a double
exception inside of the telemetryFailureProcessor when the message is not
valid **but** when the message is valid, the exception still comes up!. Even
though the processor is removed from the route, the java.sql.SQLException is
not being caught. My hunch is that the exceptions are not even caught by the
onException handler!. 



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

Re: Problem with exception handler (onException) on Camel 2.12.X routes.

Posted by "kraythe ." <kr...@gmail.com>.
I suspect you have two exceptions propagating. One occurs in the main body
of your route. This causes the onException block to trigger but immediately
its bringing up  the second exception when trying to process
the telemetryFailureProcessor. The second is causing the the onException
block to except itself. I would advise putting some trace
system.out.println inside that processor, or better yet catching it in a
debugger,and seeing if this is the issue. Why an older version of camel
handled it is another question.  From the route I cant see anything wrong
so I suspect the problem is in the custom code. I dont know what behavior
camel will have if you throw inside an onException block but I suspect
something like you are seeing here.

*Robert Simmons Jr. MSc. - Lead Java Architect @ EA*
*Author of: Hardcore Java (2003) and Maintainable Java (2012)*
*LinkedIn: **http://www.linkedin.com/pub/robert-simmons/40/852/a39
<http://www.linkedin.com/pub/robert-simmons/40/852/a39>*


On Wed, Dec 11, 2013 at 6:12 AM, jguerra <jg...@gmail.com> wrote:

> I posted to you both a copy of the whole camel.xml. It's a working copy on
> Camel 2.7.0, but for some reason I got the problems described above on
> Camel
> 2.12.1.
> Please feel free to contact me to get more information
>
>
>
> --
> View this message in context:
> http://camel.465427.n5.nabble.com/Problem-with-exception-handler-onException-on-Camel-2-12-X-routes-tp5742605p5744598.html
> Sent from the Camel - Users mailing list archive at Nabble.com.
>

Re: Problem with exception handler (onException) on Camel 2.12.X routes.

Posted by jguerra <jg...@gmail.com>.
I posted to you both a copy of the whole camel.xml. It's a working copy on
Camel 2.7.0, but for some reason I got the problems described above on Camel
2.12.1.
Please feel free to contact me to get more information



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

Re: Problem with exception handler (onException) on Camel 2.12.X routes.

Posted by "kraythe ." <kr...@gmail.com>.
There is little we can do without seeing the route and noting where the
exception was thrown.

*Robert Simmons Jr. MSc. - Lead Java Architect @ EA*
*Author of: Hardcore Java (2003) and Maintainable Java (2012)*
*LinkedIn: **http://www.linkedin.com/pub/robert-simmons/40/852/a39
<http://www.linkedin.com/pub/robert-simmons/40/852/a39>*


On Tue, Dec 10, 2013 at 7:33 AM, Dharmendra Patel <
dharmendra.k.patel@gmail.com> wrote:

> Hi,
> Can you please share the xml route.
>
>
> On Tue, Dec 10, 2013 at 6:30 PM, jguerra <jg...@gmail.com> wrote:
>
> > Hi,
> > I switched </transaced> and <onException> with no luck!. Camel still
> > doesn't
> > catch any exception. I am tried with java.lang.Exception and
> > java.sql.SQLException. The funniest part is that it works with older
> > versions !
> >
> >
> >
> >
> >
> > --
> > View this message in context:
> >
> http://camel.465427.n5.nabble.com/Problem-with-exception-handler-onException-on-Camel-2-12-X-routes-tp5742605p5744563.html
> > Sent from the Camel - Users mailing list archive at Nabble.com.
> >
>

Re: Problem with exception handler (onException) on Camel 2.12.X routes.

Posted by Dharmendra Patel <dh...@gmail.com>.
Hi,
Can you please share the xml route.


On Tue, Dec 10, 2013 at 6:30 PM, jguerra <jg...@gmail.com> wrote:

> Hi,
> I switched </transaced> and <onException> with no luck!. Camel still
> doesn't
> catch any exception. I am tried with java.lang.Exception and
> java.sql.SQLException. The funniest part is that it works with older
> versions !
>
>
>
>
>
> --
> View this message in context:
> http://camel.465427.n5.nabble.com/Problem-with-exception-handler-onException-on-Camel-2-12-X-routes-tp5742605p5744563.html
> Sent from the Camel - Users mailing list archive at Nabble.com.
>