我正在使用stomp
从ruby脚本向ActiveMQ发送XML内容我明确地设置了content-type标头toapplication / xml; charset = utf-8如下所示
client.publish queue, xml, {'content-type'=>'application/xml;charset=utf-8'}
但是当我从使用spring-integration读取消息的java客户端读取消息时,content-type是text / plain。
因此,当调用unmarshaller时,解析失败并出现异常
1448446 [org.springframework.jms.listener.DefaultMessageListenerContainer#0-1] WARN org.springframework.jms.listener.DefaultMessageListenerContainer - Execution of JMS message listener failed
org.springframework.integration.transformer.MessageTransformationException: failed to transform message payload
at org.springframework.integration.transformer.AbstractPayloadTransformer.transform(AbstractPayloadTransformer.java:40)
at org.springframework.integration.transformer.MessageTransformingHandler.handleRequestMessage(MessageTransformingHandler.java:49)
at org.springframework.integration.handler.AbstractReplyProducingMessageHandler.handleMessageInternal(AbstractReplyProducingMessageHandler.java:91)
at org.springframework.integration.handler.AbstractMessageHandler.handleMessage(AbstractMessageHandler.java:59)
at org.springframework.integration.dispatcher.UnicastingDispatcher.doDispatch(UnicastingDispatcher.java:103)
at org.springframework.integration.dispatcher.UnicastingDispatcher.dispatch(UnicastingDispatcher.java:90)
at org.springframework.integration.channel.AbstractSubscribableChannel.doSend(AbstractSubscribableChannel.java:43)
at org.springframework.integration.channel.AbstractMessageChannel.send(AbstractMessageChannel.java:116)
at org.springframework.integration.channel.AbstractMessageChannel.send(AbstractMessageChannel.java:94)
at org.springframework.integration.channel.MessageChannelTemplate.doSend(MessageChannelTemplate.java:223)
at org.springframework.integration.channel.MessageChannelTemplate.send(MessageChannelTemplate.java:180)
at org.springframework.integration.router.AbstractMessageRouter.handleMessageInternal(AbstractMessageRouter.java:76)
at org.springframework.integration.handler.AbstractMessageHandler.handleMessage(AbstractMessageHandler.java:59)
at org.springframework.integration.dispatcher.UnicastingDispatcher.doDispatch(UnicastingDispatcher.java:103)
at org.springframework.integration.dispatcher.UnicastingDispatcher.dispatch(UnicastingDispatcher.java:90)
at org.springframework.integration.channel.AbstractSubscribableChannel.doSend(AbstractSubscribableChannel.java:43)
at org.springframework.integration.channel.AbstractMessageChannel.send(AbstractMessageChannel.java:116)
at org.springframework.integration.channel.AbstractMessageChannel.send(AbstractMessageChannel.java:94)
at org.springframework.integration.channel.MessageChannelTemplate.doSend(MessageChannelTemplate.java:223)
at org.springframework.integration.channel.MessageChannelTemplate.send(MessageChannelTemplate.java:180)
at org.springframework.integration.channel.MessageChannelTemplate.send(MessageChannelTemplate.java:168)
at org.springframework.integration.jms.ChannelPublishingJmsMessageListener.onMessage(ChannelPublishingJmsMessageListener.java:203)
at org.springframework.jms.listener.AbstractMessageListenerContainer.doInvokeListener(AbstractMessageListenerContainer.java:518)
at org.springframework.jms.listener.AbstractMessageListenerContainer.invokeListener(AbstractMessageListenerContainer.java:479)
at org.springframework.jms.listener.AbstractMessageListenerContainer.doExecuteListener(AbstractMessageListenerContainer.java:451)
at org.springframework.jms.listener.AbstractPollingMessageListenerContainer.doReceiveAndExecute(AbstractPollingMessageListenerContainer.java:323)
at org.springframework.jms.listener.AbstractPollingMessageListenerContainer.receiveAndExecute(AbstractPollingMessageListenerContainer.java:261)
at org.springframework.jms.listener.DefaultMessageListenerContainer$AsyncMessageListenerInvoker.invokeListener(DefaultMessageListenerContainer.java:982)
at org.springframework.jms.listener.DefaultMessageListenerContainer$AsyncMessageListenerInvoker.executeOngoingLoop(DefaultMessageListenerContainer.java:974)
at org.springframework.jms.listener.DefaultMessageListenerContainer$AsyncMessageListenerInvoker.run(DefaultMessageListenerContainer.java:876)
at java.lang.Thread.run(Thread.java:680)
Caused by: org.springframework.integration.core.MessagingException: Failed to create Source for payload type [[B]
at org.springframework.integration.xml.source.DomSourceFactory.createSource(DomSourceFactory.java:62)
at org.springframework.integration.xml.transformer.XmlPayloadUnmarshallingTransformer.transformPayload(XmlPayloadUnmarshallingTransformer.java:91)
at org.springframework.integration.transformer.AbstractPayloadTransformer.transform(AbstractPayloadTransformer.java:33)
... 30 more
可能是什么问题
答案 0 :(得分:2)
找到答案,标题suppress_content_length
添加这个使它工作
:suppress_content_length =>真