camel-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Claus Ibsen <claus.ib...@gmail.com>
Subject Re: Error handling with transaction
Date Tue, 02 Aug 2011 12:45:11 GMT
Hi

Could you try swapping the order of <transacted/> and <onException>.


On Tue, Aug 2, 2011 at 12:19 PM, Mirko Caserta <mirko.caserta@gmail.com> wrote:
> Hi there,
> I'm having an issue I don't understand.
>
> I have a transactional route defined like this:
>
>        <route id="accountingRoute">
>            <from uri="cxf:bean:resellerAccountingEndpoint"/>
>            <transacted/>
>            <onException>
>                <exception>java.lang.Exception</exception>
>                <bean ref="inboundErrorHandler"/>
>                <wireTap ref="databaseInput"/>
>                <rollback markRollbackOnly="true"/>
>            </onException>
>            <choice id="depositSplitterChoice">
>            ...snip...
>
> You can see I don't have handled=true in the onException block. That's
> because my inboundErrorHandler bean does an
> exchange.setException(soapFaultInstance) so that cxf is happy and
> returns the right soap fault message.
>
> The issue I'm having is that, after my inboundErrorHandler has done
> its job catching a SocketTimeoutException (I can see the soapFault
> instance logged by the Tracer), I get a NPE in camel which makes my
> endpoint return a:
>
> <soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
>   <soap:Body>
>      <soap:Fault>
>         <faultcode>soap:Server</faultcode>
>         <faultstring>java.lang.NullPointerException</faultstring>
>      </soap:Fault>
>   </soap:Body>
> </soap:Envelope>
>
> The relevant stack trace portion is:
>
> ...snip...
> Caused by: org.apache.camel.RuntimeCamelException:
> java.lang.NullPointerException
>        at org.apache.camel.util.ObjectHelper.wrapRuntimeCamelException(ObjectHelper.java:1139)
> ~[camel-core-2.7.2.jar:2.7.2]
>        at org.apache.camel.spring.spi.TransactionErrorHandler$1.doInTransactionWithoutResult(TransactionErrorHandler.java:178)
> ~[camel-spring-2.7.2.jar:2.7.2]
>        at org.springframework.transaction.support.TransactionCallbackWithoutResult.doInTransaction(TransactionCallbackWithoutResult.java:33)
> ~[spring-tx-3.0.5.RELEASE.jar:3.0.5.RELEASE]
> ...snip...
>
> Am I doing something wrong or is this a bug in camel?
>
> I can provide logs, route definitions, code... anything you might need
> in case someone wishes to debug this.
>
> Thanks in advance, Mirko.
>



-- 
Claus Ibsen
-----------------
FuseSource
Email: cibsen@fusesource.com
Web: http://fusesource.com
Twitter: davsclaus, fusenews
Blog: http://davsclaus.blogspot.com/
Author of Camel in Action: http://www.manning.com/ibsen/

Mime
View raw message