Classnotfoundexception导致SimpleMessagelistenerContainer停止

时间:2015-11-09 13:17:43

标签: spring-amqp

我发现当监听器抛出classnotfoundexception时,simplemessagelistenercontainer将停止并且不适用于序列消息。

我设置了defaultrejectqueue为false,我是否还要捕获所有异常并重新抛出amqprejectrequeueexception?

  

2015-11-17 14:15:59.808 ERROR 27121 --- [cTaskExecutor-2] o.s.a.r.l.SimpleMessageListenerContainer:消费者线程错误,线程中止。 java.lang.NullPointerException:java.util.Properties $ LineReader.readLine(Properties.java:434)〜[na:1.7.0_45] java.util.Properties.load0(Properties.java:353)〜[na :1.7.0_45]在java.util.Properties.load(Properties.java:341)〜[na:1.7.0_45] com.ibm.cds.common.util.Settings.loadSettingResource(Settings.java:73)〜 [cds_common-1.0.0.jar!/:61]来自com的com.ibm.cds.common.util.Settings.init(Settings.java:61)〜[cds_common-1.0.0.jar!/:61] .ibm.cds.common.util.Settings。(Settings.java:40)〜[cds_common-1.0.0.jar!/:61] ...省略了22个常见帧包装方式:java.lang.ExceptionInInitializerError:null at com.ibm.cds.common.util.TemplateUtils。(TemplateUtils.java:57)〜[cds_common-1.0.0.jar!/:61]在com.ibm.cds.oss.response.ResizeServer.sendMail(ResizeServer。 java:377)〜[cds_backend_service-1.0.0.jar!/:61]在com.ibm.cds.oss.response.ResizeServer.endProcess(ResizeServer.java:330)〜[cds_backend_service-1.0.0.jar! /:61]在com.ibm.cds.oss.response.AbsResponse.excute(AbsResponse.java:88)〜[cds_backend_service-1.0.0.jar!/:61] com.ibm.pmc.bss.message。 com.ibm.pmc.bss.message.services.OperationResponseService $$ FastClassBySpringCGLIB $中的services.OperationResponseService.handleOssResultResponse(OperationResponseService.java:79)〜[pmc-bss-messaging-1.0-SNAPSHOT.jar!/:1.0-SNAPSHOT] org.springframework.cglib.proxy.MethodProxy.invoke(MethodProxy.java:204)〜[spring-core] $ 30aa261b.invoke()〜[spring-core-4.2.1.RELEASE.jar!/:1.0-SNAPSHOT] -4.2.1.RELEASE.jar!/:4.2.1.RELEASE]在org.springframework.aop.framework.CglibAopProxy $ DynamicAdvisedInterceptor.intercept(CglibAopProxy.java:649)〜[spring-aop-4.2.1.RELEASE。 jar!/:4.2.1.RELEASE] at com.ibm.pmc.bss.message.services.OperationResponseService $$ EnhancerBySpringCGLIB $$ a3025491.handleOssResultResponse()〜[spring-core-4.2.1.RELEASE.jar!/: 1.0-SNAPSHOT]在com.ibm.pmc.bss.message.components.Consumer.receive(C onsumer.java:24)〜[pmc-bss-messaging-1.0-SNAPSHOT.jar!/:1.0-SNAPSHOT] at com.ibm.pmc.bss.message.DynamicMessageListenerContainerRegistry $ 2.onMessage(DynamicMessageListenerContainerRegistry.java:218)~ [在org.springframework.amqp.rabbit.listener.AbstractMessageListenerContainer.doInvokeListener(AbstractMessageListenerContainer.java:800)〜[spring-rabbit-1.5.1.RELEASE]的pmc-bss-messaging-1.0-SNAPSHOT.jar!/:1.0-SNAPSHOT .jar!/:na] at org.springframework上的org.springframework.amqp.rabbit.listener.AbstractMessageListenerContainer.invokeListener(AbstractMessageListenerContainer.java:691)〜[spring-rabbit-1.5.1.RELEASE.jar!/:na] .amqp.rabbit.listener.SimpleMessageListenerContainer.access $ 001(SimpleMessageListenerContainer.java:93)〜[spring-rabbit-1.5.1.RELEASE.jar!/:na] at org.springframework.amqp.rabbit.listener.SimpleMessageListenerContainer $ 1。 org.springfram中的invokeListener(SimpleMessageListenerContainer.java:183)〜[spring-rabbit-1.5.1.RELEASE.jar!/:na] ework.amqp.rabbit.listener.SimpleMessageListenerContainer.invokeListener(SimpleMessageListenerContainer.java:1345)〜[spring-rabbit-1.5.1.RELEASE.jar!/:na] at org.springframework.amqp.rabbit.listener.AbstractMessageListenerContainer.executeListener (AbstractMessageListenerContainer.java:661)〜[spring-rabbit-1.5.1.RELEASE.jar!/:na] at org.springframework.amqp.rabbit.listener.SimpleMessageListenerContainer.doReceiveAndExecute(SimpleMessageListenerContainer.java:1096)〜[spring- rabbit-1.5.1.RELEASE.jar!/:na] at org.springframework.amqp.rabbit.listener.SimpleMessageListenerContainer.receiveAndExecute(SimpleMessageListenerContainer.java:1080)~ [spring-rabbit-1.5.1.RELEASE.jar!/ :nag at org.springframework.amqp.rabbit.listener.SimpleMessageListenerContainer.access $ 800(SimpleMessageListenerContainer.java:93)〜[spring-rabbit-1.5.1.RELEASE.jar!/:na] at org.springframework.amqp。 rabbit.listener.SimpleMessageListenerContainer $ AsyncMessageProcessingConsumer.run(S在java.lang.Thread.run(Thread.java:744)[na:1.7.0_45] 2015-11-中的[execute-true-rabbit-1.5.1.RELEASE.jar!/:na] ~informMessageListenerContainer.java:1190) 17 14:15:59.812 ERROR 27121 --- [cTaskExecutor-2] osarlSimpleMessageListenerContainer:从流产的消费者处停止容器2015-11-17 14:15:59.817 INFO 27121 --- [cTaskExecutor-2] osarlSimpleMessageListenerContainer:等待工人完成。

1 个答案:

答案 0 :(得分:0)

不清楚你的意思;如果在初始化过程中找不到类,那么容器当然不会启动。

如果侦听器在正常的消息处理过程中抛出ClassNotFoundException,则该消息将被拒绝(并且根据配置重新排队或不重新排队);但容器不会停止。

您需要准确解释您的意思,包括堆栈跟踪(编辑问题 - 不要尝试将堆栈跟踪放在注释中)。

修改

那里没有找到类的异常,只是一个空指针异常:

  

2015-11-17 14:15:59.808 ERROR 27121 --- [cTaskExecutor-2] o.s.a.r.l.SimpleMessageListenerContainer:消费者线程错误,线程中止。 java.lang.NullPointerException:java.util.Properties $ LineReader.readLine(Properties.java:434)〜[na:1.7.0_45] java.util.Properties.load0(Properties.java:353)〜[na :1.7.0_45]在java.util.Properties.load(Properties.java:341)〜[na:1.7.0_45] com.ibm.cds.common.util.Settings.loadSettingResource(Settings.java:73)〜 [cds_common-1.0.0.jar!/:61]在com.ibm.cds.common.util.Settings.init(Settings.java:61)〜

这是致命错误

  

14:15:59.812 ERROR 27121 --- [cTaskExecutor-2] o.s.a.r.l.SimpleMessageListenerContainer:从已中止的消费者中停止容器

您需要修复代码,以便容器可以启动。