![](/img/trans.png)
[英]Spring Integration JMS header 'priority' must be a number
[英]spring integration migration 3 to 4 (JMS header issues)
我正在将Web应用程序从Spring 3.1迁移到4.1。 我们用:
框架,集成,批处理,安全性和Web服务,
在大多数情况下,这是一个相对轻松的过程。 但是,我在集成方面遇到了一个问题。 此JMS消息:
GenericMessage [payload=com.etp.bpm.services.jaxwsbindings.data.ProcessActionInstance@50be7b46,标头={errorChannel=org.springframework.messaging.core.GenericMessagingTemplate$TemporaryReplyChannel@98f5a14,jms_timestamp = 1447280384929,determindantName = SeasonPer .springframework.messaging.core.GenericMessagingTemplate $ TemporaryReplyChannel @ 98f5a14,processActionName = DerivationExecutionAction,jms_replyTo = HornetQQueue [asyncActionReplyQueue],jms_messageId = ID:4fd881ab-88c2-11e5-a7c1-a7dd934,5693894 acdf-9bdc4330e68f,JMSXDeliveryCount = 1,jms_redelivered = false, 优先级= 4 ,determinantTypes = [Raw],jms_correlationId = e82424fd-3dab-4ef1-bad2-9a6ec7356a11_1,groups = [PrimaryDeterminantsGroup,10分钟,每周准备]
导致此错误:
java.lang.Exception:“ priority”标头值必须为Integer。
当spring尝试验证org.springframework.integration.IntegrationMessageHeaderAccessor中的标头值时,将引发错误,随后该过程将失败:
else if (IntegrationMessageHeaderAccessor.SEQUENCE_NUMBER.equals(headerName)
|| IntegrationMessageHeaderAccessor.SEQUENCE_SIZE.equals(headerName)
|| IntegrationMessageHeaderAccessor.PRIORITY.equals(headerName)) {
Assert.isTrue(Integer.class.isAssignableFrom(headerValue.getClass()), "The '" + headerName
+ "' header value must be an Integer.");
}
我们的应用程序中没有任何JMS代码。 Spring创建并处理所有消息,因此它如何创建无法处理的标头?
我以为这可能是Integration,integration-jms和jms-api之间的版本不匹配问题,但是我安装了所有正确的jar。 任何建议将不胜感激。 谢谢。 (请参见下面的堆栈跟踪)
14:38:05,376 INFO [stdout] (Deferred Command #8) java.lang.Exception: The 'priority' header value must be an Integer.
14:38:05,376 INFO [stdout] (Deferred Command #8) at org.springframework.util.Assert.isTrue(Assert.java:65)
14:38:05,377 INFO [stdout] (Deferred Command #8) at org.springframework.integration.IntegrationMessageHeaderAccessor.verifyType(IntegrationMessageHeaderAccessor.java:109)
14:38:05,377 INFO [stdout] (Deferred Command #8) at org.springframework.messaging.support.MessageHeaderAccessor.setHeader(MessageHeaderAccessor.java:308)
14:38:05,377 INFO [stdout] (Deferred Command #8) at org.springframework.messaging.support.MessageHeaderAccessor.copyHeaders(MessageHeaderAccessor.java:393)
14:38:05,377 INFO [stdout] (Deferred Command #8) at org.springframework.integration.support.MessageBuilder.copyHeaders(MessageBuilder.java:154)
14:38:05,377 INFO [stdout] (Deferred Command #8) at org.springframework.integration.support.MessageBuilder.copyHeaders(MessageBuilder.java:42)
14:38:05,377 INFO [stdout] (Deferred Command #8) at org.springframework.integration.jms.JmsOutboundGateway.handleRequestMessage(JmsOutboundGateway.java:691)
14:38:05,377 INFO [stdout] (Deferred Command #8) at org.springframework.integration.handler.AbstractReplyProducingMessageHandler.handleMessageInternal(AbstractReplyProducingMessageHandler.java:99)
14:38:05,377 INFO [stdout] (Deferred Command #8) at org.springframework.integration.handler.AbstractMessageHandler.handleMessage(AbstractMessageHandler.java:78)
14:38:05,377 INFO [stdout] (Deferred Command #8) at org.springframework.integration.dispatcher.AbstractDispatcher.tryOptimizedDispatch(AbstractDispatcher.java:116)
14:38:05,377 INFO [stdout] (Deferred Command #8) at org.springframework.integration.dispatcher.UnicastingDispatcher.doDispatch(UnicastingDispatcher.java:101)
14:38:05,377 INFO [stdout] (Deferred Command #8) at org.springframework.integration.dispatcher.UnicastingDispatcher.dispatch(UnicastingDispatcher.java:97)
14:38:05,377 INFO [stdout] (Deferred Command #8) at org.springframework.integration.channel.AbstractSubscribableChannel.doSend(AbstractSubscribableChannel.java:77)
14:38:05,377 INFO [stdout] (Deferred Command #8) at org.springframework.integration.channel.AbstractMessageChannel.send(AbstractMessageChannel.java:287)
14:38:05,377 INFO [stdout] (Deferred Command #8) at org.springframework.integration.channel.AbstractMessageChannel.send(AbstractMessageChannel.java:245)
14:38:05,378 INFO [stdout] (Deferred Command #8) at org.springframework.messaging.core.GenericMessagingTemplate.doSend(GenericMessagingTemplate.java:115)
14:38:05,378 INFO [stdout] (Deferred Command #8) at org.springframework.messaging.core.GenericMessagingTemplate.doSendAndReceive(GenericMessagingTemplate.java:150)
14:38:05,378 INFO [stdout] (Deferred Command #8) at org.springframework.messaging.core.GenericMessagingTemplate.doSendAndReceive(GenericMessagingTemplate.java:45)
14:38:05,378 INFO [stdout] (Deferred Command #8) at org.springframework.messaging.core.AbstractMessagingTemplate.sendAndReceive(AbstractMessagingTemplate.java:42)
14:38:05,378 INFO [stdout] (Deferred Command #8) at org.springframework.messaging.core.AbstractMessagingTemplate.convertSendAndReceive(AbstractMessagingTemplate.java:79)
14:38:05,378 INFO [stdout] (Deferred Command #8) at org.springframework.messaging.core.AbstractMessagingTemplate.convertSendAndReceive(AbstractMessagingTemplate.java:70)
14:38:05,378 INFO [stdout] (Deferred Command #8) at org.springframework.integration.gateway.MessagingGatewaySupport.doSendAndReceive(MessagingGatewaySupport.java:321)
14:38:05,378 INFO [stdout] (Deferred Command #8) at org.springframework.integration.gateway.MessagingGatewaySupport.sendAndReceive(MessagingGatewaySupport.java:298)
14:38:05,378 INFO [stdout] (Deferred Command #8) at org.springframework.integration.gateway.GatewayProxyFactoryBean.invokeGatewayMethod(GatewayProxyFactoryBean.java:414)
14:38:05,378 INFO [stdout] (Deferred Command #8) at org.springframework.integration.gateway.GatewayProxyFactoryBean.doInvoke(GatewayProxyFactoryBean.java:374)
14:38:05,378 INFO [stdout] (Deferred Command #8) at org.springframework.integration.gateway.GatewayProxyFactoryBean.invoke(GatewayProxyFactoryBean.java:365)
14:38:05,378 INFO [stdout] (Deferred Command #8) at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:179)
14:38:05,379 INFO [stdout] (Deferred Command #8) at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:207)
14:38:05,379 INFO [stdout] (Deferred Command #8) at com.sun.proxy.$Proxy129.executeAsyncAction(Unknown Source)
14:38:05,379 INFO [stdout] (Deferred Command #8) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
14:38:05,379 INFO [stdout] (Deferred Command #8) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
14:38:05,379 INFO [stdout] (Deferred Command #8) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
14:38:05,379 INFO [stdout] (Deferred Command #8) at java.lang.reflect.Method.invoke(Method.java:606)
14:38:05,379 INFO [stdout] (Deferred Command #8) at org.springframework.aop.support.AopUtils.invokeJoinpointUsingReflection(AopUtils.java:317)
14:38:05,379 INFO [stdout] (Deferred Command #8) at org.springframework.aop.framework.ReflectiveMethodInvocation.invokeJoinpoint(ReflectiveMethodInvocation.java:190)
14:38:05,379 INFO [stdout] (Deferred Command #8) at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:157)
14:38:05,379 INFO [stdout] (Deferred Command #8) at org.springframework.aop.framework.adapter.MethodBeforeAdviceInterceptor.invoke(MethodBeforeAdviceInterceptor.java:52)
14:38:05,379 INFO [stdout] (Deferred Command #8) at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:168)
14:38:05,379 INFO [stdout] (Deferred Command #8) at org.springframework.aop.aspectj.AspectJAfterAdvice.invoke(AspectJAfterAdvice.java:43)
14:38:05,379 INFO [stdout] (Deferred Command #8) at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:168)
14:38:05,380 INFO [stdout] (Deferred Command #8) at org.springframework.aop.interceptor.ExposeInvocationInterceptor.invoke(ExposeInvocationInterceptor.java:92)
14:38:05,380 INFO [stdout] (Deferred Command #8) at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:179)
14:38:05,380 INFO [stdout] (Deferred Command #8) at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:207)
14:38:05,381 INFO [stdout] (Deferred Command #8) at com.sun.proxy.$Proxy232.executeAsyncAction(Unknown Source)
14:38:05,381 INFO [stdout] (Deferred Command #8) at com.etp.bpm.actionservice.BaseActionServiceInvocationCommand.sendRequest(BaseActionServiceInvocationCommand.java:165)
14:38:05,381 INFO [stdout] (Deferred Command #8) at com.etp.bpm.actionservice.AffinityCheckActionServiceInvocationCommand.executeCommand(AffinityCheckActionServiceInvocationCommand.java:94)
14:38:05,381 INFO [stdout] (Deferred Command #8) at com.etp.bpm.command.AbstractDeferredBpmCommand.call(AbstractDeferredBpmCommand.java:82)
14:38:05,381 INFO [stdout] (Deferred Command #8) at com.etp.bpm.command.AbstractDeferredBpmCommand.call(AbstractDeferredBpmCommand.java:1)
14:38:05,381 INFO [stdout] (Deferred Command #8) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
14:38:05,382 INFO [stdout] (Deferred Command #8) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
14:38:05,382 INFO [stdout] (Deferred Command #8) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
14:38:05,382 INFO [stdout] (Deferred Command #8) at java.lang.reflect.Method.invoke(Method.java:606)
14:38:05,382 INFO [stdout] (Deferred Command #8) at org.springframework.aop.support.AopUtils.invokeJoinpointUsingReflection(AopUtils.java:317)
14:38:05,382 INFO [stdout] (Deferred Command #8) at org.springframework.aop.framework.ReflectiveMethodInvocation.invokeJoinpoint(ReflectiveMethodInvocation.java:190)
14:38:05,382 INFO [stdout] (Deferred Command #8) at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:157)
14:38:05,382 INFO [stdout] (Deferred Command #8) at org.springframework.transaction.interceptor.TransactionInterceptor$1.proceedWithInvocation(TransactionInterceptor.java:99)
14:38:05,382 INFO [stdout] (Deferred Command #8) at org.springframework.transaction.interceptor.TransactionAspectSupport.invokeWithinTransaction(TransactionAspectSupport.java:281)
14:38:05,382 INFO [stdout] (Deferred Command #8) at org.springframework.transaction.interceptor.TransactionInterceptor.invoke(TransactionInterceptor.java:96)
14:38:05,382 INFO [stdout] (Deferred Command #8) at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:179)
14:38:05,382 INFO [stdout] (Deferred Command #8) at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:207)
14:38:05,382 INFO [stdout] (Deferred Command #8) at com.sun.proxy.$Proxy233.call(Unknown Source)
14:38:05,382 INFO [stdout] (Deferred Command #8) at java.util.concurrent.FutureTask.run(FutureTask.java:262)
14:38:05,382 INFO [stdout] (Deferred Command #8) at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
14:38:05,382 INFO [stdout] (Deferred Command #8) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
14:38:05,382 INFO [stdout] (Deferred Command #8) at java.lang.Thread.run(Thread.java:745)
不。 看起来上游有人添加了priority
标头,但好像是Long
而不是Integer
。
这就是为什么它停止工作的原因。 版本不匹配没有什么特别的。
只需在您的应用程序中扫描priority
词,然后尝试找出克服方法即可。
建议之一可以像<header-filter header-names="priority">
一样,位于<int-jms:outbound-gateway>
前面。
该框架的早期版本未映射入站优先级。
这是在4.0 JIRA中添加的。
headers.put(IntegrationMessageHeaderAccessor.PRIORITY, jmsMessage.getJMSPriority());
根据API ,它应该是一个int
。
但是似乎HornetQ使用了其他方法(在给定API的情况下,还不能完全确定如何使用)。
作为一种解决方法,如@Artem所述,您可以将其过滤掉,或将入站头映射器上的mapInboundPriority
属性设置为false
。 我们在预期诸如此类的问题时添加了此布尔值。
文档在这里 。
请打开JIRA问题,以便我们准确确定HornetQ将其设置为什么。 或者,也许您可以看看调试器。
可能是HornetQ错误。
谢谢。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.