I have a postgres connection and I have given wrong credentials, I want to
catch connection exception in camel context. It never catch the exception. 

see camel context
<bean id="myQ"
class="org.apache.activemq.camel.component.ActiveMQComponent">
 <property name="brokerURL" value="tcp://localhost:61616"/>
</bean>
        
<camel:errorHandler id="deadLetterErrorHandler" type="DeadLetterChannel" 
deadLetterUri="activemq:myQ:errQueue">
<camel:redeliveryPolicy maximumRedeliveries="3" redeliveryDelay="1000" />
</camel:errorHandler>
                
<camelContext id="myContext"
                xmlns="http://camel.apache.org/schema/spring";
errorHandlerRef="deadLetterErrorHandler" >

<onException>
        
<exception>org.springframework.jdbc.CannotGetJdbcConnectionException</exception>
                
<exception>org.apache.commons.dbcp.SQLNestedException</exception>
        
<exception>org.springframework.dao.DataAccessResourceFailureException</exception>
        
<exception>org.springframework.jdbc.support.MetaDataAccessException</exception>
                <handled>
                        <constant>true</constant>
                </handled> 
                <setHeader headerName="ExceptionStacktrace">
                        <simple>${exception.stacktrace}</simple>
                </setHeader>
                <setHeader headerName="ExceptionMessage">
                        <simple>${exception.message}</simple>
                </setHeader>
                <to uri="activemq:myQ:errQueue" />
</onException>

<route id="routeid1" handleFault="true" >
<from uri="start" />
.
.
<to uri="seda:asyncOne" />
</route>

<route id="routeid2" handleFault="true" >
        <from uri="seda:asyncOne" />
        <setHeader headerName="BATCH_STATUS">
                <method ref="demoProcessor" method="process" />
        </setHeader>
.
.
.
</route>


Throws exception but could not be caught.

see the log:
org.springframework.retry.ExhaustedRetryException: Retry exhausted after
last attempt in recovery path, but exception is not skippable.; nested
exception is org.springframework.dao.DataAccessResourceFailureException:
Error retreiving database metadata; nested exception is
org.springframework.jdbc.support.MetaDataAccessException: Could not get
Connection for extracting meta data; nested exception is
org.springframework.jdbc.CannotGetJdbcConnectionException: Could not get
JDBC Connection; nested exception is
org.apache.commons.dbcp.SQLNestedException: Cannot create
PoolableConnectionFactory (FATAL: password authentication failed for user
"test_user1")

Thanks in advance



--
View this message in context: 
http://camel.465427.n5.nabble.com/DataAccessResourceFailureException-was-not-handled-by-onException-DSL-tp5756550.html
Sent from the Camel - Users mailing list archive at Nabble.com.

Reply via email to