org.springframework.integration.dispatcher.AggregateMessageDeliveryException: All attempts to deliver Message to MessageHandlers failed. Multiple causes: error occurred in message handler [ServiceActivator for [org.springframework.integration.handler.ExpressionCommandMessageProcessor@13936e1]] Expression evaluation failed: @firstService.process(payload) See below for the stacktrace of the first cause.

Spring JIRA | Brandon M. | 6 years ago
tip
Click on the to mark the solution that helps you, Samebug will learn from it.
As a community member, you’ll be rewarded for you help.
  1. 0

    Service Activator's expression only appears to accept either String or Expression payloads. The documentation doesn't clarify this restriction. If this is indeed the intended behavior, I request that the reference guide be more clear. The references section I looked at for Service activator (http://static.springsource.org/spring-integration/reference/htmlsingle/#service-activator-namespace) didn't imply this restriction. My XML config was as follows: <channel id="inboundControlChannel" /> <control-bus input-channel="inboundControlChannel" /> <channel id="firstSplitterChannel" /> <service-activator input-channel="inboundControlChannel" output-channel="firstSplitterChannel" expression="@firstService.process(payload)" /> <logging-channel-adapter channel="firstSplitterChannel" level="INFO" log-full-message="true" /> And My service: @Service public class FirstService { public List<String> process(Class<?> clazz) { //business processing } } And finally test: public class TestSpringInt { /** * @param args * @throws ClassNotFoundException */ public static void main(String[] args) throws ClassNotFoundException { ApplicationContext ctx = new AnnotationConfigApplicationContext( AppConfig.class); Message<?> msg = MessageBuilder.withPayload( Class.forName("java.lang.String")).build(); DirectChannel controlChannel = ctx.getBean("inboundControlChannel", DirectChannel.class); controlChannel.send(msg); } } Resulting Exception: INFO: [Payload=class java.lang.String][Headers={timestamp=1300642249615, id=8e69e76e-63ed-4232-8af7-aa36d61bbc1f, history=inboundControlChannel,loggingChannel}] Exception in thread "main" org.springframework.integration.dispatcher.AggregateMessageDeliveryException: All attempts to deliver Message to MessageHandlers failed. Multiple causes: error occurred in message handler [ServiceActivator for [org.springframework.integration.handler.ExpressionCommandMessageProcessor@13936e1]] Expression evaluation failed: @firstService.process(payload) See below for the stacktrace of the first cause. at org.springframework.integration.dispatcher.UnicastingDispatcher.handleExceptions(UnicastingDispatcher.java:160) at org.springframework.integration.dispatcher.UnicastingDispatcher.doDispatch(UnicastingDispatcher.java:123) at org.springframework.integration.dispatcher.UnicastingDispatcher.dispatch(UnicastingDispatcher.java:97) at org.springframework.integration.channel.AbstractSubscribableChannel.doSend(AbstractSubscribableChannel.java:44) at org.springframework.integration.channel.AbstractMessageChannel.send(AbstractMessageChannel.java:157) at org.springframework.integration.channel.AbstractMessageChannel.send(AbstractMessageChannel.java:128) at org.mycompany.springInt.TestSpringInt.main(TestSpringInt.java:26) Caused by: org.springframework.integration.MessageHandlingException: error occurred in message handler [ServiceActivator for [org.springframework.integration.handler.ExpressionCommandMessageProcessor@13936e1]] at org.springframework.integration.handler.AbstractMessageHandler.handleMessage(AbstractMessageHandler.java:84) at org.springframework.integration.dispatcher.UnicastingDispatcher.doDispatch(UnicastingDispatcher.java:110) ... 5 more Caused by: java.lang.IllegalArgumentException: Message payload must be an Expression instance or an expression String. at org.springframework.integration.handler.ExpressionCommandMessageProcessor.processMessage(ExpressionCommandMessageProcessor.java:65) at org.springframework.integration.handler.ServiceActivatingHandler.handleRequestMessage(ServiceActivatingHandler.java:64) at org.springframework.integration.handler.AbstractReplyProducingMessageHandler.handleMessageInternal(AbstractReplyProducingMessageHandler.java:98) at org.springframework.integration.handler.AbstractMessageHandler.handleMessage(AbstractMessageHandler.java:78) ... 6 more

    Spring JIRA | 6 years ago | Brandon M.
    org.springframework.integration.dispatcher.AggregateMessageDeliveryException: All attempts to deliver Message to MessageHandlers failed. Multiple causes: error occurred in message handler [ServiceActivator for [org.springframework.integration.handler.ExpressionCommandMessageProcessor@13936e1]] Expression evaluation failed: @firstService.process(payload) See below for the stacktrace of the first cause.
  2. 0

    Service Activator's expression only appears to accept either String or Expression payloads. The documentation doesn't clarify this restriction. If this is indeed the intended behavior, I request that the reference guide be more clear. The references section I looked at for Service activator (http://static.springsource.org/spring-integration/reference/htmlsingle/#service-activator-namespace) didn't imply this restriction. My XML config was as follows: <channel id="inboundControlChannel" /> <control-bus input-channel="inboundControlChannel" /> <channel id="firstSplitterChannel" /> <service-activator input-channel="inboundControlChannel" output-channel="firstSplitterChannel" expression="@firstService.process(payload)" /> <logging-channel-adapter channel="firstSplitterChannel" level="INFO" log-full-message="true" /> And My service: @Service public class FirstService { public List<String> process(Class<?> clazz) { //business processing } } And finally test: public class TestSpringInt { /** * @param args * @throws ClassNotFoundException */ public static void main(String[] args) throws ClassNotFoundException { ApplicationContext ctx = new AnnotationConfigApplicationContext( AppConfig.class); Message<?> msg = MessageBuilder.withPayload( Class.forName("java.lang.String")).build(); DirectChannel controlChannel = ctx.getBean("inboundControlChannel", DirectChannel.class); controlChannel.send(msg); } } Resulting Exception: INFO: [Payload=class java.lang.String][Headers={timestamp=1300642249615, id=8e69e76e-63ed-4232-8af7-aa36d61bbc1f, history=inboundControlChannel,loggingChannel}] Exception in thread "main" org.springframework.integration.dispatcher.AggregateMessageDeliveryException: All attempts to deliver Message to MessageHandlers failed. Multiple causes: error occurred in message handler [ServiceActivator for [org.springframework.integration.handler.ExpressionCommandMessageProcessor@13936e1]] Expression evaluation failed: @firstService.process(payload) See below for the stacktrace of the first cause. at org.springframework.integration.dispatcher.UnicastingDispatcher.handleExceptions(UnicastingDispatcher.java:160) at org.springframework.integration.dispatcher.UnicastingDispatcher.doDispatch(UnicastingDispatcher.java:123) at org.springframework.integration.dispatcher.UnicastingDispatcher.dispatch(UnicastingDispatcher.java:97) at org.springframework.integration.channel.AbstractSubscribableChannel.doSend(AbstractSubscribableChannel.java:44) at org.springframework.integration.channel.AbstractMessageChannel.send(AbstractMessageChannel.java:157) at org.springframework.integration.channel.AbstractMessageChannel.send(AbstractMessageChannel.java:128) at org.mycompany.springInt.TestSpringInt.main(TestSpringInt.java:26) Caused by: org.springframework.integration.MessageHandlingException: error occurred in message handler [ServiceActivator for [org.springframework.integration.handler.ExpressionCommandMessageProcessor@13936e1]] at org.springframework.integration.handler.AbstractMessageHandler.handleMessage(AbstractMessageHandler.java:84) at org.springframework.integration.dispatcher.UnicastingDispatcher.doDispatch(UnicastingDispatcher.java:110) ... 5 more Caused by: java.lang.IllegalArgumentException: Message payload must be an Expression instance or an expression String. at org.springframework.integration.handler.ExpressionCommandMessageProcessor.processMessage(ExpressionCommandMessageProcessor.java:65) at org.springframework.integration.handler.ServiceActivatingHandler.handleRequestMessage(ServiceActivatingHandler.java:64) at org.springframework.integration.handler.AbstractReplyProducingMessageHandler.handleMessageInternal(AbstractReplyProducingMessageHandler.java:98) at org.springframework.integration.handler.AbstractMessageHandler.handleMessage(AbstractMessageHandler.java:78) ... 6 more

    Spring JIRA | 6 years ago | Brandon M.
    org.springframework.integration.dispatcher.AggregateMessageDeliveryException: All attempts to deliver Message to MessageHandlers failed. Multiple causes: error occurred in message handler [ServiceActivator for [org.springframework.integration.handler.ExpressionCommandMessageProcessor@13936e1]] Expression evaluation failed: @firstService.process(payload) See below for the stacktrace of the first cause.

    Root Cause Analysis

    1. java.lang.IllegalArgumentException

      Message payload must be an Expression instance or an expression String.

      at org.springframework.integration.handler.ExpressionCommandMessageProcessor.processMessage()
    2. Spring Integration Core
      AbstractMessageChannel.send
      1. org.springframework.integration.handler.ExpressionCommandMessageProcessor.processMessage(ExpressionCommandMessageProcessor.java:65)
      2. org.springframework.integration.handler.ServiceActivatingHandler.handleRequestMessage(ServiceActivatingHandler.java:64)
      3. org.springframework.integration.handler.AbstractReplyProducingMessageHandler.handleMessageInternal(AbstractReplyProducingMessageHandler.java:98)
      4. org.springframework.integration.handler.AbstractMessageHandler.handleMessage(AbstractMessageHandler.java:78)
      5. org.springframework.integration.dispatcher.UnicastingDispatcher.doDispatch(UnicastingDispatcher.java:110)
      6. org.springframework.integration.dispatcher.UnicastingDispatcher.dispatch(UnicastingDispatcher.java:97)
      7. org.springframework.integration.channel.AbstractSubscribableChannel.doSend(AbstractSubscribableChannel.java:44)
      8. org.springframework.integration.channel.AbstractMessageChannel.send(AbstractMessageChannel.java:157)
      9. org.springframework.integration.channel.AbstractMessageChannel.send(AbstractMessageChannel.java:128)
      9 frames
    3. org.mycompany.springInt
      TestSpringInt.main
      1. org.mycompany.springInt.TestSpringInt.main(TestSpringInt.java:26)
      1 frame