我遇到了非常不寻常的问题。我在spring webservice组件中的spring Integration flow(ver 2.1.0)中使用header-value-router 像:
<int:header-value-router id="routerId" input-channel="routeChannel"
header-name="msgtype" resolution-required="true">
<int:mapping value="north" channel="channelA"/>
<int:mapping value="south" channel="channelB"/>
</int:header-value-router>
当我通过JUnit调用流时,这非常有效,但是当这个webserivce组件部署在tcserver中并且webservice调用SI流时,它在header-value-router失败并出现以下错误
[16.01.2013 23:14:25] WARN:GatewayProxyFactoryBean$MethodInvocationGateway.doSendAndReceive() - failure occurred in gateway sendAndReceive
**org.springframework.integration.MessagingException: failed to resolve channel name 'north'**
at org.springframework.integration.router.AbstractMappingMessageRouter.resolveChannelForName(AbstractMappingMessageRouter.java:168)
at org.springframework.integration.router.AbstractMappingMessageRouter.addChannelFromString(AbstractMappingMessageRouter.java:197)
at org.springframework.integration.router.AbstractMappingMessageRouter.addToCollection(AbstractMappingMessageRouter.java:218)
我调试了spring source并发现当调用header-value-router时,映射被加载但在源代码中没有正确比较 AbstractMappingMessageRouter.java
if (this.channelMappings.containsKey(channelKey)) {
channelName = this.channelMappings.get(channelKey);
}
'containsKey'的失败导致代码假设标题值具有channelName。
不确定是什么问题。如果运行时丢失了一些jar?我甚至试过xpath-router和router,但结果是一样的