camel-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Mirko Caserta <mirko.case...@gmail.com>
Subject Error handling with transaction
Date Tue, 02 Aug 2011 10:19:47 GMT
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.

Mime
View raw message