Ghosty
Ghosty

Reputation: 83

NPE in Spring Integration LoggingHandler

I'm facing some weird NPE with no details thrown by org.springframework.integration.handler.LoggingHandler. The previous log entry is 2 minutes before which is also strange.

Does anyone have any idea what can be the reason behind it?

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

Upvotes: 0

Views: 1346

Answers (1)

Artem Bilan
Artem Bilan

Reputation: 121272

The code you talk about looks like:

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

The clearly means that delegate.process() throws NPE somehow.

According to the StackTrace you have some Service Activator to call your POJO service method. And that looks like exactly your method already throws that NPE.

I also believe that there is something else in the StackTrace after Caused by: java.lang.NullPointerException.

You see that as an ERROR in your logs, because you have some polling flow starting from some source - Inbound Channel Adapter. And any exception thrown downstream are caught by the error handler in the Poller Ednpoint and sent to the errorChannel with the LoggingHandler as a default subscriber.

See Reference Manual for more info.

Upvotes: 1

Related Questions