gpt4 book ai didi

java - Spring Integration LoggingHandler 中的 NPE

转载 作者:行者123 更新时间:2023-12-02 12:29:58 25 4
gpt4 key购买 nike

我面临着一些奇怪的 NPE,org.springframework.integration.handler.LoggingHandler 没有抛出任何详细信息。之前的日志条目是 2 分钟前的,这也很奇怪。

有人知道这背后的原因是什么吗?

2017-07-25 18:33:38.561 DEBUG o.s.b.f.s.DefaultListableBeanFactory     : Returning cached instance of singleton bean 'markEodPositionsAsProcessedChannel'
2017-07-25 18:35:36.985 ERROR o.s.integration.handler.LoggingHandler : org.springframework.messaging.MessageHandlingException: nested exception is java.lang.NullPointerException
at org.springframework.integration.handler.MethodInvokingMessageProcessor.processMessage(MethodInvokingMessageProcessor.java:96)
at org.springframework.integration.handler.ServiceActivatingHandler.handleRequestMessage(ServiceActivatingHandler.java:89)
at org.springframework.integration.handler.AbstractReplyProducingMessageHandler.handleMessageInternal(AbstractReplyProducingMessageHandler.java:109)
at org.springframework.integration.handler.AbstractMessageHandler.handleMessage(AbstractMessageHandler.java:127)
at org.springframework.integration.dispatcher.AbstractDispatcher.tryOptimizedDispatch(AbstractDispatcher.java:116)
at org.springframework.integration.dispatcher.UnicastingDispatcher.doDispatch(UnicastingDispatcher.java:148)
at org.springframework.integration.dispatcher.UnicastingDispatcher.access$000(UnicastingDispatcher.java:53)
at org.springframework.integration.dispatcher.UnicastingDispatcher$3.run(UnicastingDispatcher.java:129)
at org.springframework.integration.util.ErrorHandlingTaskExecutor$1.run(ErrorHandlingTaskExecutor.java:55)
at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
at java.lang.Thread.run(Unknown Source)
Caused by: java.lang.NullPointerException

最佳答案

您谈论的代码如下所示:

public T processMessage(Message<?> message) {
try {
return this.delegate.process(message);
}
catch (Exception e) {
throw new MessageHandlingException(message, e);
}
}

这显然意味着delegate.process()会以某种方式抛出NPE

根据 StackTrace,您有一些服务激活器来调用 POJO 服务方法。看起来你的方法已经抛出了 NPE

我还相信,在 Caused by: java.lang.NullPointerException 之后,StackTrace 中还有其他内容。

您会在日志中看到这是一个ERROR,因为您有一些轮询流从某个源(入站 channel 适配器)开始。下游抛出的任何异常都会被 Poller Ednpoint 中的错误处理程序捕获,并以 LoggingHandler 作为默认订阅者发送到 errorChannel

参见Reference Manual了解更多信息。

关于java - Spring Integration LoggingHandler 中的 NPE,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/45326013/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com