我遇到了非常不寻常的问题。我在spring webservice组件中的spring集成流程(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 调用流程时,这非常有效,但是当这个 web 服务组件部署在 tcserver 中并且 web 服务调用 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源,发现当调用header-value-router时,映射被加载但在源代码AbstractMappingMessageRouter.java中没有正确比较
if (this.channelMappings.containsKey(channelKey)) {
channelName = this.channelMappings.get(channelKey);
}
'containsKey' 处的此失败导致代码假定标头值具有通道名称。
不知道是什么问题。如果在运行时缺少一些 jar 可以吗?我什至试过xpath-router和router,但结果是一样的