2017-07-26 53 views
0

我正面臨一些不可思議的NPE,沒有任何細節拋出org.springframework.integration.handler.LoggingHandler。之前的日誌條目是2分鐘之前,這也很奇怪。NPE在Spring集成日誌處理程序

有沒有人有任何想法背後的原因是什麼?

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 

回答

0

你談論看起來像代碼:

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

的明確意味着delegate.process()拋出NPE莫名其妙。

根據StackTrace,你有一些Service Activator來調用你的POJO服務方法。這看起來像你的方法已經拋出了NPE

我也相信Caused by: java.lang.NullPointerException之後StackTrace中還有別的東西。

您可以在日誌中看到ERROR,因爲您有一些從某些源開始的輪詢流 - 入站通道適配器。並且拋出的任何異常都會被Poller Ednpoint中的錯誤處理程序捕獲併發送到errorChannelLoggingHandler作爲默認訂戶。

有關更多信息,請參閱Reference Manual