服务器日志文件中包含堆栈跟踪,无法使用Camel ActiveMQ JMS停止堆栈跟踪的记录

我正在使用Camel 2.9.1和Spring 3.1.1.RELEASE和ActiveMQ 5.5.1 .

我有一个Swing GUI客户端,它使用Camel JMS对数据服务进行 @InOut 请求 - 回复调用,该服务在我们服务器上的Karaf / Felix OSGi容器中运行 .

在某些情况下,此服务会抛出我们希望在客户端中处理的异常 .

当抛出这些异常时,Camel将它们传递回包含在 RuntimeCamelException 中的客户端,并且一切正常 .

但现在我想要抑制Camel似乎在Exception传回客户端时自动记录的堆栈跟踪 . 这是服务器日志的一个片段:

2012-11-01 13:04:13,463 | ERROR | org.apache.camel.util.CamelLogger | Failed delivery for (MessageId: ID-pc01-48122-1351720826468-9-121549 on ExchangeId: ID-pc01-48122-1351720826468-9-121547). Exhausted after delivery attempt: 1 caught:org.apache.camel.RuntimeCamelException: our.own.SomethingException: Some explanation of exception here

org.apache.camel.RuntimeCamelException: our.own.SomethingException: Some explanation of exception here

at org.apache.camel.util.ObjectHelper.wrapRuntimeCamelException(ObjectHelper.java:1221)[120:org.apache.camel.camel-core:2.9.1]

at org.apache.camel.component.bean.BeanInvocation.invoke(BeanInvocation.java:87)[120:org.apache.camel.camel-core:2.9.1]

at org.apache.camel.component.bean.BeanProcessor.process(BeanProcessor.java:128)[120:org.apache.camel.camel-core:2.9.1]

at org.apache.camel.util.AsyncProcessorHelper.process(AsyncProcessorHelper.java:99)[120:org.apache.camel.camel-core:2.9.1]

at org.apache.camel.component.bean.BeanProcessor.process(BeanProcessor.java:73)[120:org.apache.camel.camel-core:2.9.1]

at org.apache.camel.impl.ProcessorEndpoint.onExchange(ProcessorEndpoint.java:101)[120:org.apache.camel.camel-core:2.9.1]

at org.apache.camel.impl.ProcessorEndpoint$1.process(ProcessorEndpoint.java:71)[120:org.apache.camel.camel-core:2.9.1]

at org.apache.camel.util.AsyncProcessorConverterHelper$ProcessorToAsyncProcessorBridge.process(AsyncProcessorConverterHelper.java:61)[120:org.apache.camel.camel-core:2.9.1]

at org.apache.camel.util.AsyncProcessorHelper.process(AsyncProcessorHelper.java:73)[120:org.apache.camel.camel-core:2.9.1]

... etc.

在日志中立即跟随:

2012-11-01 13:04:13,517 | WARN | org.apache.camel.util.CamelLogger | Execution of JMS message listener failed. Caused by: [org.apache.camel.RuntimeCamelException - our.own.SomethingException: Some explanation of exception here]

org.apache.camel.RuntimeCamelException: our.own.SomethingException: Some explanation of exception here

at org.apache.camel.util.ObjectHelper.wrapRuntimeCamelException(ObjectHelper.java:1221)[120:org.apache.camel.camel-core:2.9.1]

at org.apache.camel.component.bean.BeanInvocation.invoke(BeanInvocation.java:87)[120:org.apache.camel.camel-core:2.9.1]

at org.apache.camel.component.bean.BeanProcessor.process(BeanProcessor.java:128)[120:org.apache.camel.camel-core:2.9.1]

at org.apache.camel.util.AsyncProcessorHelper.process(AsyncProcessorHelper.java:99)[120:org.apache.camel.camel-core:2.9.1]

at org.apache.camel.component.bean.BeanProcessor.process(BeanProcessor.java:73)[120:org.apache.camel.camel-core:2.9.1]

at org.apache.camel.impl.ProcessorEndpoint.onExchange(ProcessorEndpoint.java:101)[120:org.apache.camel.camel-core:2.9.1]

at org.apache.camel.impl.ProcessorEndpoint$1.process(ProcessorEndpoint.java:71)[120:org.apache.camel.camel-core:2.9.1]

at org.apache.camel.util.AsyncProcessorConverterHelper$ProcessorToAsyncProcessorBridge.process(AsyncProcessorConverterHelper.java:61)[120:org.apache.camel.camel-core:2.9.1]

at org.apache.camel.util.AsyncProcessorHelper.process(AsyncProcessorHelper.java:73)[120:org.apache.camel.camel-core:2.9.1]

at org.apache.camel.processor.SendProcessor$2.doInAsyncProducer(SendProcessor.java:115)[120:org.apache.camel.camel-core:2.9.1]

at org.apache.camel.impl.ProducerCache.doInAsyncProducer(ProducerCache.java:285)[120:org.apache.camel.camel-core:2.9.1]

at org.apache.camel.processor.SendProcessor.process(SendProcessor.java:110)[120:org.apache.camel.camel-core:2.9.1]

...etc

现在 Client 的Spring文件具有以下定义:

哪个 errorHandlerLogStackTrace 属性设置为'false',所以我'm not sure why it'仍然记录堆栈跟踪 .

我是否需要在服务器端具有类似的属性设置(因为这是包含堆栈跟踪的服务器日志)?

顺便说一句,这些东西大部分是由一位不再为我们工作的前雇员设立的 . 虽然我对正在发生的事情有相当好的理解,但对我来说,其中一些仍然是个谜 .

UPDATE: 5/11/12 - After Claus's answer

好吧,我通过Spring DSL XML文件进行了更多挖掘,发现JMS组件正在服务器上的一个名为“broker”的独立OSGi包中定义,而其他服务器包正在引用它 . 该捆绑包具有与客户端(上面)相同的'jms'bean的XML定义 .

我将'errorHandlerLogStackTrace'属性添加到此定义中,并且已设法摆脱其中一个堆栈跟踪 . 我现在得到的是带有堆栈跟踪的错误,紧接着是没有堆栈跟踪的WARN . 这是一个更完整的代码段:

2012-11-05 10:44:35,323 | ERROR | org.apache.camel.util.CamelLogger | Failed delivery for (MessageId: ID-pc01-38192-1352065125718-9-62 on ExchangeId: ID-pc01-38192-1352065125718-9-60). Exhausted after delivery attempt: 1 caught: org.apache.camel.RuntimeCamelException: our.own.SomethingException: Some explanation of exception here

org.apache.camel.RuntimeCamelException: our.own.SomethingException: Some explanation of exception here

at org.apache.camel.util.ObjectHelper.wrapRuntimeCamelException(ObjectHelper.java:1221)[120:org.apache.camel.camel-core:2.9.1]

at org.apache.camel.component.bean.BeanInvocation.invoke(BeanInvocation.java:87)[120:org.apache.camel.camel-core:2.9.1]

at org.apache.camel.component.bean.BeanProcessor.process(BeanProcessor.java:128)[120:org.apache.camel.camel-core:2.9.1]

at org.apache.camel.util.AsyncProcessorHelper.process(AsyncProcessorHelper.java:99)[120:org.apache.camel.camel-core:2.9.1]

at org.apache.camel.component.bean.BeanProcessor.process(BeanProcessor.java:73)[120:org.apache.camel.camel-core:2.9.1]

at org.apache.camel.impl.ProcessorEndpoint.onExchange(ProcessorEndpoint.java:101)[120:org.apache.camel.camel-core:2.9.1]

at org.apache.camel.impl.ProcessorEndpoint$1.process(ProcessorEndpoint.java:71)[120:org.apache.camel.camel-core:2.9.1]

at org.apache.camel.util.AsyncProcessorConverterHelper$ProcessorToAsyncProcessorBridge.process(AsyncProcessorConverterHelper.java:61)[120:org.apache.camel.camel-core:2.9.1]

at org.apache.camel.util.AsyncProcessorHelper.process(AsyncProcessorHelper.java:73)[120:org.apache.camel.camel-core:2.9.1]

at org.apache.camel.processor.SendProcessor$2.doInAsyncProducer(SendProcessor.java:115)[120:org.apache.camel.camel-core:2.9.1]

at org.apache.camel.impl.ProducerCache.doInAsyncProducer(ProducerCache.java:285)[120:org.apache.camel.camel-core:2.9.1]

at org.apache.camel.processor.SendProcessor.process(SendProcessor.java:110)[120:org.apache.camel.camel-core:2.9.1]

at org.apache.camel.util.AsyncProcessorHelper.process(AsyncProcessorHelper.java:73)[120:org.apache.camel.camel-core:2.9.1]

at org.apache.camel.processor.DelegateAsyncProcessor.processNext(DelegateAsyncProcessor.java:99)[120:org.apache.camel.camel-core:2.9.1]

at org.apache.camel.processor.DelegateAsyncProcessor.process(DelegateAsyncProcessor.java:90)[120:org.apache.camel.camel-core:2.9.1]

at org.apache.camel.management.InstrumentationProcessor.process(InstrumentationProcessor.java:71)[120:org.apache.camel.camel-core:2.9.1]

at org.apache.camel.util.AsyncProcessorHelper.process(AsyncProcessorHelper.java:73)[120:org.apache.camel.camel-core:2.9.1]

at org.apache.camel.processor.DelegateAsyncProcessor.processNext(DelegateAsyncProcessor.java:99)[120:org.apache.camel.camel-core:2.9.1]

at org.apache.camel.processor.DelegateAsyncProcessor.process(DelegateAsyncProcessor.java:90)[120:org.apache.camel.camel-core:2.9.1]

at org.apache.camel.processor.interceptor.TraceInterceptor.process(TraceInterceptor.java:91)[120:org.apache.camel.camel-core:2.9.1]

at org.apache.camel.util.AsyncProcessorHelper.process(AsyncProcessorHelper.java:73)[120:org.apache.camel.camel-core:2.9.1]

at org.apache.camel.processor.RedeliveryErrorHandler.processErrorHandler(RedeliveryErrorHandler.java:333)[120:org.apache.camel.camel-core:2.9.1]

at org.apache.camel.processor.RedeliveryErrorHandler.process(RedeliveryErrorHandler.java:223)[120:org.apache.camel.camel-core:2.9.1]

at org.apache.camel.processor.RouteContextProcessor.processNext(RouteContextProcessor.java:45)[120:org.apache.camel.camel-core:2.9.1]

at org.apache.camel.processor.DelegateAsyncProcessor.process(DelegateAsyncProcessor.java:90)[120:org.apache.camel.camel-core:2.9.1]

at org.apache.camel.processor.interceptor.DefaultChannel.process(DefaultChannel.java:304)[120:org.apache.camel.camel-core:2.9.1]

at org.apache.camel.processor.RouteContextProcessor.processNext(RouteContextProcessor.java:45)[120:org.apache.camel.camel-core:2.9.1]

at org.apache.camel.processor.DelegateAsyncProcessor.process(DelegateAsyncProcessor.java:90)[120:org.apache.camel.camel-core:2.9.1]

at org.apache.camel.processor.UnitOfWorkProcessor.processAsync(UnitOfWorkProcessor.java:150)[120:org.apache.camel.camel-core:2.9.1]

at org.apache.camel.processor.UnitOfWorkProcessor.process(UnitOfWorkProcessor.java:117)[120:org.apache.camel.camel-core:2.9.1]

at org.apache.camel.util.AsyncProcessorHelper.process(AsyncProcessorHelper.java:73)[120:org.apache.camel.camel-core:2.9.1]

at org.apache.camel.processor.DelegateAsyncProcessor.processNext(DelegateAsyncProcessor.java:99)[120:org.apache.camel.camel-core:2.9.1]

at org.apache.camel.processor.DelegateAsyncProcessor.process(DelegateAsyncProcessor.java:90)[120:org.apache.camel.camel-core:2.9.1]

at org.apache.camel.management.InstrumentationProcessor.process(InstrumentationProcessor.java:71)[120:org.apache.camel.camel-core:2.9.1]

at org.apache.camel.util.AsyncProcessorHelper.process(AsyncProcessorHelper.java:99)[120:org.apache.camel.camel-core:2.9.1]

at org.apache.camel.processor.DelegateAsyncProcessor.process(DelegateAsyncProcessor.java:86)[120:org.apache.camel.camel-core:2.9.1]

at org.apache.camel.component.jms.EndpointMessageListener.onMessage(EndpointMessageListener.java:104)[147:org.apache.camel.camel-jms:2.9.1]

at org.springframework.jms.listener.AbstractMessageListenerContainer.doInvokeListener(AbstractMessageListenerContainer.java:562)[63:org.springframework.jms:3.1.1.RELEASE]

at org.springframework.jms.listener.AbstractMessageListenerContainer.invokeListener(AbstractMessageListenerContainer.java:500)[63:org.springframework.jms:3.1.1.RELEASE]

at org.springframework.jms.listener.AbstractMessageListenerContainer.doExecuteListener(AbstractMessageListenerContainer.java:468)[63:org.springframework.jms:3.1.1.RELEASE]

at org.springframework.jms.listener.AbstractPollingMessageListenerContainer.doReceiveAndExecute(AbstractPollingMessageListenerContainer.java:326)[63:org.springframework.jms:3.1.1.RELEASE]

at org.springframework.jms.listener.AbstractPollingMessageListenerContainer.receiveAndExecute(AbstractPollingMessageListenerContainer.java:264)[63:org.springframework.jms:3.1.1.RELEASE]

at org.springframework.jms.listener.DefaultMessageListenerContainer$AsyncMessageListenerInvoker.invokeListener(DefaultMessageListenerContainer.java:1071)[63:org.springframework.jms:3.1.1.RELEASE]

at org.springframework.jms.listener.DefaultMessageListenerContainer$AsyncMessageListenerInvoker.executeOngoingLoop(DefaultMessageListenerContainer.java:1063)[63:org.springframework.jms:3.1.1.RELEASE]

at org.springframework.jms.listener.DefaultMessageListenerContainer$AsyncMessageListenerInvoker.run(DefaultMessageListenerContainer.java:960)[63:org.springframework.jms:3.1.1.RELEASE]

at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886)[:1.6.0_24]

at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908)[:1.6.0_24]

at java.lang.Thread.run(Thread.java:662)[:1.6.0_24]

Caused by: our.own.SomethingException: Some explanation of exception here

at uniworks.ServiceManagers.SuperDataManager.createInUseForEntity(SuperDataManager.java:2156)[220:uniworks-ejb:1.1.4.SNAPSHOT]

at uniworks.ServiceManagers.SuperDataManager.findForEdit(SuperDataManager.java:913)[220:uniworks-ejb:1.1.4.SNAPSHOT]

at uniworks.ServiceManagers.SuperDataManager.findForEdit(SuperDataManager.java:853)[220:uniworks-ejb:1.1.4.SNAPSHOT]

at uniworks.ServiceManagers.SuperDataManager.findForEdit(SuperDataManager.java:843)[220:uniworks-ejb:1.1.4.SNAPSHOT]

at sun.reflect.GeneratedMethodAccessor106.invoke(Unknown Source)

at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)[:1.6.0_24]

at java.lang.reflect.Method.invoke(Method.java:597)[:1.6.0_24]

at org.springframework.aop.support.AopUtils.invokeJoinpointUsingReflection(AopUtils.java:318)[55:org.springframework.aop:3.1.1.RELEASE]

at org.springframework.aop.framework.ReflectiveMethodInvocation.invokeJoinpoint(ReflectiveMethodInvocation.java:183)[55:org.springframework.aop:3.1.1.RELEASE]

at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:150)[55:org.springframework.aop:3.1.1.RELEASE]

at org.springframework.transaction.interceptor.TransactionInterceptor.invoke(TransactionInterceptor.java:110)[65:org.springframework.transaction:3.1.1.RELEASE]

at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:172)[55:org.springframework.aop:3.1.1.RELEASE]

at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:202)[55:org.springframework.aop:3.1.1.RELEASE]

at $Proxy221.findForEdit(Unknown Source)

at sun.reflect.GeneratedMethodAccessor106.invoke(Unknown Source)

at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)[:1.6.0_24]

at java.lang.reflect.Method.invoke(Method.java:597)[:1.6.0_24]

at org.springframework.aop.support.AopUtils.invokeJoinpointUsingReflection(AopUtils.java:318)[55:org.springframework.aop:3.1.1.RELEASE]

at org.springframework.osgi.service.importer.support.internal.aop.ServiceInvoker.doInvoke(ServiceInvoker.java:58)

at org.springframework.osgi.service.importer.support.internal.aop.ServiceInvoker.invoke(ServiceInvoker.java:62)

at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:172)[55:org.springframework.aop:3.1.1.RELEASE]

at org.springframework.aop.support.DelegatingIntroductionInterceptor.doProceed(DelegatingIntroductionInterceptor.java:131)[55:org.springframework.aop:3.1.1.RELEASE]

at org.springframework.aop.support.DelegatingIntroductionInterceptor.invoke(DelegatingIntroductionInterceptor.java:119)[55:org.springframework.aop:3.1.1.RELEASE]

at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:172)[55:org.springframework.aop:3.1.1.RELEASE]

at org.springframework.osgi.service.util.internal.aop.ServiceTCCLInterceptor.invokeUnprivileged(ServiceTCCLInterceptor.java:56)

at org.springframework.osgi.service.util.internal.aop.ServiceTCCLInterceptor.invoke(ServiceTCCLInterceptor.java:39)

at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:172)[55:org.springframework.aop:3.1.1.RELEASE]

at org.springframework.osgi.service.importer.support.LocalBundleContextAdvice.invoke(LocalBundleContextAdvice.java:59)[90:org.springframework.osgi.core:1.2.1]

at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:172)[55:org.springframework.aop:3.1.1.RELEASE]

at org.springframework.aop.support.DelegatingIntroductionInterceptor.doProceed(DelegatingIntroductionInterceptor.java:131)[55:org.springframework.aop:3.1.1.RELEASE]

at org.springframework.aop.support.DelegatingIntroductionInterceptor.invoke(DelegatingIntroductionInterceptor.java:119)[55:org.springframework.aop:3.1.1.RELEASE]

at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:172)[55:org.springframework.aop:3.1.1.RELEASE]

at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:202)[55:org.springframework.aop:3.1.1.RELEASE]

at $Proxy1044.findForEdit(Unknown Source)

at sun.reflect.GeneratedMethodAccessor106.invoke(Unknown Source)

at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)[:1.6.0_24]

at java.lang.reflect.Method.invoke(Method.java:597)[:1.6.0_24]

at org.apache.camel.component.bean.BeanInvocation.invoke(BeanInvocation.java:83)[120:org.apache.camel.camel-core:2.9.1]

... 46 more

2012-11-05 10:44:35,335 | WARN | org.apache.camel.util.CamelLogger | Execution of JMS message listener failed. Caused by: [our.own.SomethingException: Some explanation of exception here]

现在,这里可能使这些变得复杂的是此方法调用所采用的“路径” .

客户端使用JMS Request-Reply消息使用以下路由定义来调用服务器:

该路由的服务器端在一个OSGi包中定义(让我们调用'BundleA'),如下所示:

此路由中引用的bean实际上是另一个bundle('BundleB')作为OSGi'服务' . BundleA引用了这个bean,定义如下:

interface="uniworks.ServiceManagers.a.Animal.AnimalTypeDataInterface"/>

BundleB的服务定义如下:

interface="uniworks.ServiceManagers.a.Animal.AnimalTypeDataInterface"/>

正是这个最终的服务bean抛出了异常 .

我可以在这些路由的每个服务器端(在BundleA中)放置 errorHandler ,但我希望能够在一个地方一般地执行此操作 .

我尝试在BundleA中定义一个日志记录错误处理程序(根据Camel Documentation),如下所示:

..... [jms routes defined in here]

但这似乎没有任何区别 .

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值