我正在使用与 RabbitMQ AMQP 的 spring 集成并面临奇怪的行为。
我通过rabbitMQ从外部服务接收消息,但服务激活器抛出:
java.lang.ClassCastException: org.springframework.context.expression.MapAccessor cannot be cast to org.springframework.expression.PropertyAccessor
我的代码在部署到 Jboss 的 EAR 文件中运行。当我从单元测试运行相同的上下文 XML 时,消息被完美接收。
设置窃听记录器显示按预期接收的消息。
我将不胜感激任何可以指导我完成此任务的建议或想法。
我在用着:
- 弹簧表达式-3.2.4
- 弹簧集成-amqp-2.2.4
- 弹簧集成核心 2.2.4
- spring-rabbit-1.1.4
应用程序上下文是:
<int-amqp:inbound-channel-adapter
id="firedJobInboundChannelAdapter"
channel="firedNotificationChannel"
queue-names="firedJob-jboss-Q"
connection-factory="rabbitConnectionFactory"
mapped-request-headers="*" />
<int:channel id="firedNotificationChannel" />
<int:json-to-object-transformer
input-channel="firedNotificationChannel"
output-channel="firedNotificationChannelObject"
type="com.company.scheduling.JobStringDataMap"/>
<int:channel id="firedNotificationChannelObject" />
<int:service-activator input-channel="firedNotificationChannelObject" >
<bean id="firedSchedulerJobReciverBean" class="com.company.notifications.scheduler.gateway.FiredSchedulerJobReciver"/>
</int:service-activator>
例外是(错误原因以粗体显示):
引起:java.lang.ClassCastException: org.springframework.context.expression.MapAccessor 不能转换为 org.springframework.expression.PropertyAccessor 在 org.springframework.expression.spel.ast.PropertyOrFieldReference.getPropertyAccessorsToTry(PropertyOrFieldReference.java:330) 在 org.springframework.expression.spel.ast.PropertyOrFieldReference.readProperty(PropertyOrFieldReference.java:220) 在 org.springframework.expression.spel .ast.PropertyOrFieldReference.getValueInternal(PropertyOrFieldReference.java:112) at org.springframework.expression.spel.ast.PropertyOrFieldReference.getValueInternal(PropertyOrFieldReference.java:107) at org.springframework.expression.spel.ast.MethodReference.getValueRef(MethodReference .java:72) 在 org.springframework.expression.spel.ast.CompoundExpression.getValueRef(CompoundExpression.java:63) 在 org.springframework.expression.spel.ast.CompoundExpression.getValueInternal(CompoundExpression.java:82) 在 org. springframework.expression.spel.ast。SpelNodeImpl.getTypedValue(SpelNodeImpl.java:102) at org.springframework.expression.spel.standard.SpelExpression.getValue(SpelExpression.java:103) at org.springframework.integration.util.AbstractExpressionEvaluator.evaluateExpression(AbstractExpressionEvaluator.java:126)在 org.springframework.integration.util.MessagingMethodInvokerHelper.processInternal(MessagingMethodInvokerHelper.java:227) 在 org.springframework.integration.util.MessagingMethodInvokerHelper.process(MessagingMethodInvokerHelper.java:127) 在 org.springframework.integration.handler.MethodInvokingMessageProcessor.processMessage (MethodInvokingMessageProcessor.java:73) ... 37 更多AbstractExpressionEvaluator.evaluateExpression(AbstractExpressionEvaluator.java:126) at org.springframework.integration.util.MessagingMethodInvokerHelper.processInternal(MessagingMethodInvokerHelper.java:227) at org.springframework.integration.util.MessagingMethodInvokerHelper.process(MessagingMethodInvokerHelper.java:127) at org .springframework.integration.handler.MethodInvokingMessageProcessor.processMessage(MethodInvokingMessageProcessor.java:73) ... 37 更多AbstractExpressionEvaluator.evaluateExpression(AbstractExpressionEvaluator.java:126) at org.springframework.integration.util.MessagingMethodInvokerHelper.processInternal(MessagingMethodInvokerHelper.java:227) at org.springframework.integration.util.MessagingMethodInvokerHelper.process(MessagingMethodInvokerHelper.java:127) at org .springframework.integration.handler.MethodInvokingMessageProcessor.processMessage(MethodInvokingMessageProcessor.java:73) ... 37 更多MethodInvokingMessageProcessor.processMessage(MethodInvokingMessageProcessor.java:73) ... 37 更多MethodInvokingMessageProcessor.processMessage(MethodInvokingMessageProcessor.java:73) ... 37 更多