我想讀取隊列中XML格式的WMQ消息,並將它們轉換爲Java JAXB對象以供進一步分析。我寫過這樣的。如何將XML類型的WMO消息轉換爲JAXB對象?
<wmq:connector name="WMQ" hostName="localhost" port="1414" queueManager="TestMQ" channel="MY_SVRCONN" username="[email protected]" transportType="CLIENT_MQ_TCPIP" validateConnections="true" doc:name="WMQ"/>
<http:request-config name="HTTP_Request_Configuration" host="localhost" port="8085" doc:name="HTTP Request Configuration"/>
<mulexml:jaxb-context name="ELIGIBITLITY" packageNames="com.test.jaxb" doc:name="JAXB Context"/>
<flow name="mulemqclientFlow">
<wmq:inbound-endpoint queue="test.queue.local.1" connector-ref="WMQ" doc:name="WMQ"/>
<logger message="#[message.payloadAs(java.lang.Class)]" level="INFO" doc:name="Logger"/>
<mulexml:jaxb-xml-to-object-transformer jaxbContext-ref="ELIGIBITLITY" doc:name="XML to JAXB Object" ignoreBadInput="true"/>
<logger level="DEBUG" doc:name="Logger"/>
</flow>
但是我得到錯誤,如
Root Exception stack trace:
javax.jms.JMSException: Source was not of a supported type. Valid types are Message, String, Map, InputStream, List, byte[], Serializable or OutputHandler, but was ELIGIBILITY
at org.mule.transport.jms.JmsMessageUtils.toMessage(JmsMessageUtils.java:144)
at org.mule.transport.jms.transformers.AbstractJmsTransformer.transformToMessage(AbstractJmsTransformer.java:66)
at com.mulesoft.mule.transport.wmq.transformers.ObjectToWMQJmsMessage.transformMessage(ObjectToWMQJmsMessage.java:58)
at org.mule.transformer.AbstractMessageTransformer.transform(AbstractMessageTransformer.java:141)
at org.mule.transformer.AbstractMessageTransformer.transform(AbstractMessageTransformer.java:89)
at org.mule.DefaultMuleMessage.transformMessage(DefaultMuleMessage.java:1613)
at org.mule.DefaultMuleMessage.applyAllTransformers(DefaultMuleMessage.java:1516)
at org.mule.DefaultMuleMessage.applyTransformers(DefaultMuleMessage.java:1490)
at org.mule.DefaultMuleMessage.applyTransformers(DefaultMuleMessage.java:1473)
at org.mule.transport.jms.JmsReplyToHandler.processReplyTo(JmsReplyToHandler.java:90)
at org.mule.routing.requestreply.AbstractReplyToPropertyRequestReplyReplier.processReplyTo(AbstractReplyToPropertyRequestReplyReplier.java:67)
at org.mule.routing.requestreply.AbstractReplyToPropertyRequestReplyReplier.process(AbstractReplyToPropertyRequestReplyReplier.java:43)
at org.mule.execution.ExceptionToMessagingExceptionExecutionInterceptor.execute(ExceptionToMessagingExceptionExecutionInterceptor.java:24)
at org.mule.execution.MessageProcessorNotificationExecutionInterceptor.execute(MessageProcessorNotificationExecutionInterceptor.java:107)
at org.mule.execution.MessageProcessorExecutionTemplate.execute(MessageProcessorExecutionTemplate.java:44)
at org.mule.processor.BlockingProcessorExecutor.executeNext(BlockingProcessorExecutor.java:88)
at org.mule.processor.BlockingProcessorExecutor.execute(BlockingProcessorExecutor.java:59)
at org.mule.execution.ExceptionToMessagingExceptionExecutionInterceptor.execute(ExceptionToMessagingExceptionExecutionInterceptor.java:24)
at org.mule.execution.MessageProcessorExecutionTemplate.execute(MessageProcessorExecutionTemplate.java:44)
at org.mule.processor.BlockingProcessorExecutor.executeNext(BlockingProcessorExecutor.java:98)
at org.mule.processor.BlockingProcessorExecutor.execute(BlockingProcessorExecutor.java:59)
at org.mule.interceptor.AbstractEnvelopeInterceptor.processBlocking(AbstractEnvelopeInterceptor.java:58)
at org.mule.processor.AbstractRequestResponseMessageProcessor.process(AbstractRequestResponseMessageProcessor.java:47)
at org.mule.processor.AsyncInterceptingMessageProcessor.processNextTimed(AsyncInterceptingMessageProcessor.java:123)
at org.mule.processor.AsyncInterceptingMessageProcessor$AsyncMessageProcessorWorker$1.process(AsyncInterceptingMessageProcessor.java:208)
at org.mule.processor.AsyncInterceptingMessageProcessor$AsyncMessageProcessorWorker$1.process(AsyncInterceptingMessageProcessor.java:201)
at org.mule.execution.ExecuteCallbackInterceptor.execute(ExecuteCallbackInterceptor.java:16)
at org.mule.execution.CommitTransactionInterceptor.execute(CommitTransactionInterceptor.java:35)
at org.mule.execution.CommitTransactionInterceptor.execute(CommitTransactionInterceptor.java:22)
at org.mule.execution.HandleExceptionInterceptor.execute(HandleExceptionInterceptor.java:30)
at org.mule.execution.HandleExceptionInterceptor.execute(HandleExceptionInterceptor.java:14)
at org.mule.execution.BeginAndResolveTransactionInterceptor.execute(BeginAndResolveTransactionInterceptor.java:67)
at org.mule.execution.ResolvePreviousTransactionInterceptor.execute(ResolvePreviousTransactionInterceptor.java:44)
at org.mule.execution.SuspendXaTransactionInterceptor.execute(SuspendXaTransactionInterceptor.java:50)
at org.mule.execution.ValidateTransactionalStateInterceptor.execute(ValidateTransactionalStateInterceptor.java:40)
at org.mule.execution.IsolateCurrentTransactionInterceptor.execute(IsolateCurrentTransactionInterceptor.java:41)
at org.mule.execution.ExternalTransactionInterceptor.execute(ExternalTransactionInterceptor.java:48)
at org.mule.execution.RethrowExceptionInterceptor.execute(RethrowExceptionInterceptor.java:28)
at org.mule.execution.RethrowExceptionInterceptor.execute(RethrowExceptionInterceptor.java:13)
at org.mule.execution.TransactionalErrorHandlingExecutionTemplate.execute(TransactionalErrorHandlingExecutionTemplate.java:110)
at org.mule.execution.TransactionalErrorHandlingExecutionTemplate.execute(TransactionalErrorHandlingExecutionTemplate.java:30)
at org.mule.processor.AsyncInterceptingMessageProcessor$AsyncMessageProcessorWorker.doRun(AsyncInterceptingMessageProcessor.java:200)
at org.mule.work.AbstractMuleEventWork.run(AbstractMuleEventWork.java:49)
at org.mule.work.WorkerContext.run(WorkerContext.java:286)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1...