servicemix-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 not catched in a Split
Date Wed, 12 Aug 2009 09:18:50 GMT
Hi Charles

You post in the wrong forum!

On Wed, Aug 12, 2009 at 11:11 AM, Charles Moulliard<cmoulliard@gmail.com> wrote:
> I have created a unit test in camel-core/spring to reproduce what I observe
> in my project but I see that the following syntax is not correct :
>
>                from("direct:startWithError")
>                       .doTry()
>                          .split().method("error", "dummyException")
>                          .to("mock:result")
>                       // NOT ALLOWED TO ADD A CATCH HERE
>                       .doCatch(Exception.class)
>                       .to("mock:error")
>                       .end();
>
> Question : Can we use try/catch with split ?
>
> Charles Moulliard
> Senior Enterprise Architect
> Apache Camel Committer
>
> *****************************
> blog : http://cmoulliard.blogspot.com
>
>
> On Wed, Aug 12, 2009 at 8:47 AM, Charles Moulliard <cmoulliard@gmail.com>wrote:
>
>> Hi,
>>
>> It seems that an error generated in a try/catch block where a split has
>> been defined in the routing is not catched.
>>
>> Here is the route example :
>>
>>         <camel:route errorHandlerRef="txErrorHandlerReqNew">
>>             <camel:from ref="queueRequestEndpoint" />
>>             <camel:transacted ref="PROPAGATION_REQUIRED_NEW" />
>>             <camel:doTry>
>>
>>                 <camel:doTry>
>>                     <camel:convertBodyTo
>> type="com.xpectis.x3s.platform.model.Request" />
>>
>>                     <!-- Parse the request -->
>>                     <camel:bean ref="serviceHelper" method="parseRequest"
>> />
>>
>>                     <!-- Split the collection of messages -->
>>                     <camel:split strategyRef="aggregationStrat">
>>
>>                         <camel:ognl>request.body</camel:ognl>
>>
>>                         <!-- (1) Call the service to save the request
>> message -->
>>                         <camel:bean ref="serviceHelper"
>> method="createRequestMessage" />
>>
>>                         <!-- GENERATE A DUMMY ERROR -->
>>                         <camel:bean ref="serviceHelper"
>> method="generateX3SClientException" />
>>
>>                         <!-- (2) Validate the business message -->
>>                         <camel:bean ref="serviceHelper"
>> method="validateRequestMessage" />
>>
>>                         <!-- (3) Save business message -->
>>                         <camel:bean ref="serviceHelper"
>> method="saveValidatedRequestMessageWithAudit" />
>>
>>                    </camel:split>
>>
>>                     <!-- Update Request status, save Audit,.. -->
>>                     <camel:bean ref="serviceHelper"
>> method="finishRequestMessageProcessing" />
>>
>>                     <!-- If request is valid - Put result in the
>> transformation queue -->
>>                     <camel:to ref="queueRequestMessageEndpoint" />
>>
>>                     <camel:doCatch>
>>
>> <camel:exception>com.xpectis.x3s.exception.X3SClientException</camel:exception>
>>                             <camel:bean ref="serviceHelper"
>> method="updateRequestStatus"/>
>>                             <camel:bean ref="serviceHelper"
>> method="processException" />
>>                             <camel:to ref="queueReportingEndpoint"
/>
>>                     </camel:doCatch>
>>                 </camel:doTry>
>>
>>                 <camel:doCatch>
>>                     <camel:exception>java.lang.Exception</camel:exception>
>>                         <camel:to
>> uri="log:com.xpectis.x3s?level=INFO&amp;multiline=true&amp;showException=true&amp;showCaughtException=true&amp;showStackTrace=true"
>> />
>>                         <camel:rollback/>
>>                 </camel:doCatch>
>>
>>             </camel:doTry>
>>
>>         </camel:route>
>>
>>
>> Error returned :
>>
>> 08:38:52,514 | INFO  | enerContainer-29 | ServiceHelper
>> | ctis.x3s.core.util.ServiceHelper  924 | ###### generateX3SClientException
>> ######
>> 08:38:52,514 | INFO  | enerContainer-29 | TraceInterceptor
>> | rg.apache.camel.processor.Logger  166 |
>> ID-dell-charles-1223-1250058871451-0-1 >>> request.body --> request.body,
>> Pattern:InOnly, Headers:{CamelFileLength=892, JMSDeliveryMode=2,
>> JMSMessageID=ID:dell-charles-1197-1250058848764-3:8:1:1:1, JMSExpiration=0,
>> JMSTimestamp=1250059131701,
>> CamelFileAbsolutePath=d:\temp\data\oinp\OINP_Example.csv, messageType=OINP,
>> CamelBeanMethodName=null, CamelFilePath=d:\temp\data\oinp\OINP_Example.csv,
>> JMSRedelivered=false, JMSReplyTo=null, origin=file, CamelFileAbsolute=true,
>> CamelFileRelativePath=d:\temp\data\oinp\OINP_Example.csv,
>> CamelFileLastModified=Mon Jul 27 16:33:12 CEST 2009, JMSPriority=4,
>> JMSXGroupID=null, CamelBeanMultiParameterArray=false, requestId=2581,
>> CamelFileParent=d:\temp\data\oinp, CamelFileNameOnly=OINP_Example.csv,
>> JMSDestination=queue://x3s:request, CamelFileName=OINP_Example.csv,
>> JMSCorrelationID=null, JMSType=null},
>> BodyType:com.xpectis.x3s.platform.model.RequestMessage,
>> Body:com.xpectis.x3s.platform.model.RequestMessage@1cebcf0, Exception:
>> com.xpectis.x3s.exception.X3SClientException: Unknown error
>> 08:38:52,514 | INFO  | enerContainer-29 | x3sAggregationStrategy
>> | core.util.x3sAggregationStrategy   25 | >> oldExchange of aggregator is
>> null
>> 08:38:52,530 | INFO  | enerContainer-29 | TraceInterceptor
>> | rg.apache.camel.processor.Logger  166 |
>> ID:dell-charles-1197-1250058848764-3:8:1:1:1 >>> request.body -->
>> request.body, Pattern:InOnly, Headers:{CamelRedeliveryCounter=0,
>> CamelRedelivered=false, JMSDestination=queue://x3s:request, JMSPriority=4,
>> JMSReplyTo=null, JMSExpiration=0, JMSCorrelationID=null,
>> JMSTimestamp=1250059131701,
>> CamelFilePath=d:\temp\data\oinp\OINP_Example.csv, CamelBeanMethodName=null,
>> requestId=2581, CamelFileLastModified=Mon Jul 27 16:33:12 CEST 2009,
>> CamelBeanMultiParameterArray=false,
>> JMSMessageID=ID:dell-charles-1197-1250058848764-3:8:1:1:1,
>> JMSDeliveryMode=2, CamelFileLength=892, CamelFileParent=d:\temp\data\oinp,
>> CamelFileAbsolutePath=d:\temp\data\oinp\OINP_Example.csv,
>> CamelFileAbsolute=true,
>> CamelFileRelativePath=d:\temp\data\oinp\OINP_Example.csv,
>> CamelFileName=OINP_Example.csv, messageType=OINP, JMSType=null,
>> JMSRedelivered=false, origin=file, CamelFileNameOnly=OINP_Example.csv,
>> JMSXGroupID=null}, BodyType:java.util.ArrayList,
>> Body:[com.xpectis.x3s.platform.model.RequestMessage@1cebcf0],
>> Exception:org.apache.camel.spring.spi.TransactedRuntimeCamelException:
>> com.xpectis.x3s.exception.X3SClientException: Unknown error, Exception:
>> org.apache.camel.spring.spi.TransactedRuntimeCamelException:
>> com.xpectis.x3s.exception.X3SClientException: Unknown error
>> 08:38:52,545 | ERROR | enerContainer-29 | EndpointMessageListener
>> | rg.apache.camel.processor.Logger  248 |
>> com.xpectis.x3s.exception.X3SClientException: Unknown error
>> org.apache.camel.spring.spi.TransactedRuntimeCamelException:
>> com.xpectis.x3s.exception.X3SClientException: Unknown error
>>     at
>> org.apache.camel.spring.spi.TransactionErrorHandler.wrapTransactedRuntimeException(TransactionErrorHandler.java:171)
>>     at
>> org.apache.camel.spring.spi.TransactionErrorHandler$1.doInTransactionWithoutResult(TransactionErrorHandler.java:121)
>>     at
>> org.springframework.transaction.support.TransactionCallbackWithoutResult.doInTransaction(TransactionCallbackWithoutResult.java:33)
>>     at
>> org.springframework.transaction.support.TransactionTemplate.execute(TransactionTemplate.java:128)
>>     at
>> org.apache.camel.spring.spi.TransactionErrorHandler.process(TransactionErrorHandler.java:86)
>>     at
>> org.apache.camel.processor.DefaultChannel.process(DefaultChannel.java:148)
>>     at org.apache.camel.processor.Pipeline.process(Pipeline.java:74)
>>     at
>> org.apache.camel.processor.MulticastProcessor.doProcessSequntiel(MulticastProcessor.java:189)
>>     at
>> org.apache.camel.processor.MulticastProcessor.process(MulticastProcessor.java:126)
>>     at
>> org.apache.camel.processor.DelegateProcessor.processNext(DelegateProcessor.java:53)
>>     at
>> org.apache.camel.processor.DelegateProcessor.proceed(DelegateProcessor.java:82)
>>     at
>> org.apache.camel.processor.interceptor.TraceInterceptor.process(TraceInterceptor.java:148)
>>     at
>> org.apache.camel.processor.DefaultChannel.process(DefaultChannel.java:148)
>>     at org.apache.camel.processor.Pipeline.process(Pipeline.java:74)
>>     at
>> org.apache.camel.processor.TryProcessor.process(TryProcessor.java:63)
>>     at
>> org.apache.camel.processor.DelegateProcessor.processNext(DelegateProcessor.java:53)
>>     at
>> org.apache.camel.processor.DelegateProcessor.proceed(DelegateProcessor.java:82)
>>     at
>> org.apache.camel.processor.interceptor.TraceInterceptor.process(TraceInterceptor.java:148)
>>     at
>> org.apache.camel.processor.DefaultChannel.process(DefaultChannel.java:148)
>>     at
>> org.apache.camel.processor.TryProcessor.process(TryProcessor.java:63)
>>     at
>> org.apache.camel.processor.DelegateProcessor.processNext(DelegateProcessor.java:53)
>>     at
>> org.apache.camel.processor.DelegateProcessor.proceed(DelegateProcessor.java:82)
>>     at
>> org.apache.camel.processor.interceptor.TraceInterceptor.process(TraceInterceptor.java:148)
>>     at
>> org.apache.camel.management.InstrumentationProcessor.process(InstrumentationProcessor.java:61)
>>     at
>> org.apache.camel.management.InstrumentationProcessor.process(InstrumentationProcessor.java:61)
>>     at
>> org.apache.camel.processor.RedeliveryErrorHandler.processExchange(RedeliveryErrorHandler.java:186)
>>     at
>> org.apache.camel.processor.RedeliveryErrorHandler.processErrorHandler(RedeliveryErrorHandler.java:155)
>>     at
>> org.apache.camel.processor.RedeliveryErrorHandler.process(RedeliveryErrorHandler.java:88)
>>     at
>> org.apache.camel.spring.spi.TransactionErrorHandler.access$101(TransactionErrorHandler.java:41)
>>     at
>> org.apache.camel.spring.spi.TransactionErrorHandler$1.doInTransactionWithoutResult(TransactionErrorHandler.java:114)
>>     at
>> org.springframework.transaction.support.TransactionCallbackWithoutResult.doInTransaction(TransactionCallbackWithoutResult.java:33)
>>     at
>> org.springframework.transaction.support.TransactionTemplate.execute(TransactionTemplate.java:128)
>>     at
>> org.apache.camel.spring.spi.TransactionErrorHandler.process(TransactionErrorHandler.java:86)
>>     at
>> org.apache.camel.processor.DefaultChannel.process(DefaultChannel.java:148)
>>     at
>> org.apache.camel.processor.RedeliveryErrorHandler.processExchange(RedeliveryErrorHandler.java:186)
>>     at
>> org.apache.camel.processor.RedeliveryErrorHandler.processErrorHandler(RedeliveryErrorHandler.java:155)
>>     at
>> org.apache.camel.processor.RedeliveryErrorHandler.process(RedeliveryErrorHandler.java:88)
>>     at
>> org.apache.camel.spring.spi.TransactionErrorHandler.access$101(TransactionErrorHandler.java:41)
>>     at
>> org.apache.camel.spring.spi.TransactionErrorHandler$1.doInTransactionWithoutResult(TransactionErrorHandler.java:114)
>>     at
>> org.springframework.transaction.support.TransactionCallbackWithoutResult.doInTransaction(TransactionCallbackWithoutResult.java:33)
>>     at
>> org.springframework.transaction.support.TransactionTemplate.execute(TransactionTemplate.java:128)
>>     at
>> org.apache.camel.spring.spi.TransactionErrorHandler.process(TransactionErrorHandler.java:86)
>>     at
>> org.apache.camel.processor.DelegateProcessor.processNext(DelegateProcessor.java:53)
>>     at
>> org.apache.camel.processor.DelegateProcessor.proceed(DelegateProcessor.java:82)
>>     at
>> org.apache.camel.processor.interceptor.TraceInterceptor.process(TraceInterceptor.java:148)
>>     at
>> org.apache.camel.processor.RedeliveryErrorHandler.processExchange(RedeliveryErrorHandler.java:186)
>>     at
>> org.apache.camel.processor.RedeliveryErrorHandler.processErrorHandler(RedeliveryErrorHandler.java:155)
>>     at
>> org.apache.camel.processor.RedeliveryErrorHandler.process(RedeliveryErrorHandler.java:88)
>>     at
>> org.apache.camel.spring.spi.TransactionErrorHandler.access$101(TransactionErrorHandler.java:41)
>>     at
>> org.apache.camel.spring.spi.TransactionErrorHandler$1.doInTransactionWithoutResult(TransactionErrorHandler.java:114)
>>     at
>> org.springframework.transaction.support.TransactionCallbackWithoutResult.doInTransaction(TransactionCallbackWithoutResult.java:33)
>>     at
>> org.springframework.transaction.support.TransactionTemplate.execute(TransactionTemplate.java:128)
>>     at
>> org.apache.camel.spring.spi.TransactionErrorHandler.process(TransactionErrorHandler.java:86)
>>     at
>> org.apache.camel.processor.DefaultChannel.process(DefaultChannel.java:148)
>>     at
>> org.apache.camel.processor.UnitOfWorkProcessor.processNext(UnitOfWorkProcessor.java:54)
>>     at
>> org.apache.camel.processor.DelegateProcessor.process(DelegateProcessor.java:48)
>>     at
>> org.apache.camel.component.jms.EndpointMessageListener.onMessage(EndpointMessageListener.java:83)
>>     at
>> org.springframework.jms.listener.AbstractMessageListenerContainer.doInvokeListener(AbstractMessageListenerContainer.java:543)
>>     at
>> org.springframework.jms.listener.AbstractMessageListenerContainer.invokeListener(AbstractMessageListenerContainer.java:482)
>>     at
>> org.springframework.jms.listener.AbstractMessageListenerContainer.doExecuteListener(AbstractMessageListenerContainer.java:451)
>>     at
>> org.springframework.jms.listener.AbstractPollingMessageListenerContainer.doReceiveAndExecute(AbstractPollingMessageListenerContainer.java:323)
>>     at
>> org.springframework.jms.listener.AbstractPollingMessageListenerContainer.receiveAndExecute(AbstractPollingMessageListenerContainer.java:261)
>>     at
>> org.springframework.jms.listener.DefaultMessageListenerContainer$AsyncMessageListenerInvoker.invokeListener(DefaultMessageListenerContainer.java:982)
>>     at
>> org.springframework.jms.listener.DefaultMessageListenerContainer$AsyncMessageListenerInvoker.run(DefaultMessageListenerContainer.java:881)
>>     at java.lang.Thread.run(Thread.java:595)
>> Caused by: com.xpectis.x3s.exception.X3SClientException: Unknown error
>>     at
>> com.xpectis.x3s.core.util.ServiceHelper.generateX3SClientException(ServiceHelper.java:926)
>>     at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
>>     at
>> sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
>>     at
>> sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
>>     at java.lang.reflect.Method.invoke(Method.java:585)
>>     at
>> org.apache.camel.component.bean.MethodInfo.invoke(MethodInfo.java:193)
>>     at
>> org.apache.camel.component.bean.MethodInfo$1.proceed(MethodInfo.java:115)
>>     at
>> org.apache.camel.component.bean.BeanProcessor.process(BeanProcessor.java:122)
>>     at
>> org.apache.camel.processor.DelegateProcessor.processNext(DelegateProcessor.java:53)
>>     at
>> org.apache.camel.processor.DelegateProcessor.proceed(DelegateProcessor.java:82)
>>     at
>> org.apache.camel.processor.interceptor.TraceInterceptor.process(TraceInterceptor.java:148)
>>     at
>> org.apache.camel.processor.RedeliveryErrorHandler.processExchange(RedeliveryErrorHandler.java:186)
>>     at
>> org.apache.camel.processor.RedeliveryErrorHandler.processErrorHandler(RedeliveryErrorHandler.java:155)
>>     at
>> org.apache.camel.processor.RedeliveryErrorHandler.process(RedeliveryErrorHandler.java:88)
>>     at
>> org.apache.camel.spring.spi.TransactionErrorHandler.access$101(TransactionErrorHandler.java:41)
>>     at
>> org.apache.camel.spring.spi.TransactionErrorHandler$1.doInTransactionWithoutResult(TransactionErrorHandler.java:114)
>>     ... 63 more
>>
>> Is the route correct ?
>>
>> Regards,
>>
>> Charles Moulliard
>> Senior Enterprise Architect
>> Apache Camel Committer
>>
>> *****************************
>> blog : http://cmoulliard.blogspot.com
>>
>



-- 
Claus Ibsen
Apache Camel Committer

Open Source Integration: http://fusesource.com
Blog: http://davsclaus.blogspot.com/
Twitter: http://twitter.com/davsclaus

Mime
View raw message