1
我從紅寶石腳本使用跺腳跺腳內容類型報頭設置爲純對XML內容
發送XML內容的ActiveMQ我明確地設置內容類型報頭toapplication/XML;字符集= UTF- 8如下所示
client.publish queue, xml, {'content-type'=>'application/xml;charset=utf-8'}
但是,當我從使用彈簧整合到讀取該消息的Java客戶端讀取的消息中的內容類型爲text/plain。
當解組調用解析失敗與異常的結果
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
什麼能找到答案的問題
當您從Ruby客戶端讀取時會發生什麼? –
@Mark,當從ruby客戶端讀取時,內容被正確讀取 – Manoj