当前位置: 首页 > 知识库问答 >
问题:

如何阻止WSO2将ActiveMQ CorrelationID直接传递给Websphere MQ

越正阳
2023-03-14

我试图从ActiveMQ队列中提取消息并将其传递给Websphere MQ队列。

我正在使用WSO2,因为最终我们会希望使用它给我们的所有功能。

问题似乎在于WSO2试图将ActiveMQ消息Id作为相关Id直接传递给Websphere MQ,这是错误的格式

[2013-03-08 12:18:23,414] ERROR - JMSSender Error creating a JMS message from the message context
com.ibm.msg.client.jms.DetailedJMSException: JMSCMQ1044: String is not a valid hexadecimal number - 'dolguldur-51590-1362693989456-3:4:1:1:4'.
Either an attempt was made to specify a group ID or correlation ID which starts with the prefix ID but is not followed by a well-formed hexadecimal value, or an attempt was made to receive a message w
hich contains an MQRFH2 property of type bin.hex that does not have a well-formed hexadecimal value.
Ensure that a valid hexadecimal value always follows the ID prefix when setting group ID or correlation ID values. Ensure that any MQRFH2 headers generated by non-JMS applications are well-formed.
        at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
        at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:39)
        at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:27)
        at java.lang.reflect.Constructor.newInstance(Constructor.java:513)
        at com.ibm.msg.client.commonservices.j2se.NLSServices.createException(NLSServices.java:319)
        at com.ibm.msg.client.commonservices.nls.NLSServices.createException(NLSServices.java:233)
        at com.ibm.msg.client.wmq.common.internal.WMQUtils.hexToBin(WMQUtils.java:414)
        at com.ibm.msg.client.wmq.common.internal.WMQUtils.stringToId(WMQUtils.java:496)
        at com.ibm.msg.client.wmq.common.internal.messages.WMQMessageHeader.setJMSCorrelationID(WMQMessageHeader.java:314)
        at com.ibm.msg.client.jms.internal.JmsMessageImpl.setJMSCorrelationID(JmsMessageImpl.java:610)
        at com.ibm.jms.JMSMessage.setJMSCorrelationID(JMSMessage.java:1133)
        at org.apache.axis2.transport.jms.JMSSender.createJMSMessage(JMSSender.java:428)
        at org.apache.axis2.transport.jms.JMSSender.sendOverJMS(JMSSender.java:172)
        at org.apache.axis2.transport.jms.JMSSender.sendMessage(JMSSender.java:154)
        at org.apache.axis2.transport.base.AbstractTransportSender.invoke(AbstractTransportSender.java:112)
        at org.apache.axis2.engine.AxisEngine$TransportNonBlockingInvocationWorker.run(AxisEngine.java:626)
        at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886)
        at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908)
        at java.lang.Thread.run(Thread.java:662)
[2013-03-08 12:18:23,417]  INFO - AxisEngine [MessageContext: logID=a7a3184cd19f3b5ab7a012af40cd7840329dd8fc40d0e9c3] Error creating a JMS message from the message context

WSO2代理服务配置

<proxy xmlns="http://ws.apache.org/ns/synapse" name="TestService" transports="jms" statistics="disable" trace="disable" startOnLoad="true">
   <target>
      <inSequence>
         <property name="TRANSPORT_HEADERS" scope="transport" action="remove"/>
         <property name="OUT_ONLY" value="true"/>
         <log level="full"/>
      </inSequence>
      <endpoint>
         <address uri="jms:/QUEUE.OUT?transport.jms.ConnectionFactory=ibmMQQueueConnectionFactory"/>
      </endpoint>
   </target>
   <parameter name="transport.jms.ConnectionFactory">activeMQQueueConnectionFactory</parameter>
   <parameter name="transport.jms.Destination">TESTJMS.IN</parameter>
   <description></description>
</proxy>

Axis2.xml传输接收器

  <transportReceiver name="jms" class="org.apache.axis2.transport.jms.JMSListener">
        <parameter name="activeMQQueueConnectionFactory" locked="false">
            <parameter name="java.naming.factory.initial" locked="false">org.apache.activemq.jndi.ActiveMQInitialContextFactory</parameter>
            <parameter name="java.naming.provider.url" locked="false">tcp://localhost:61616</parameter>
            <parameter name="transport.jms.ConnectionFactoryJNDIName" locked="false">QueueConnectionFactory</parameter>
            <parameter name="transport.jms.ConnectionFactoryType" locked="false">queue</parameter>
        </parameter>

        <parameter name="ibmMQQueueConnectionFactory" locked="false">
            <parameter name="java.naming.factory.initial" locked="false">com.sun.jndi.fscontext.RefFSContextFactory</parameter>
            <parameter name="java.naming.provider.url" locked="false">file:/E:/work/MQ-JNDI-Directory</parameter>
            <parameter name="transport.jms.ConnectionFactoryJNDIName" locked="false">ConnectionFactoryTest</parameter>
            <parameter name="transport.jms.ConnectionFactoryType" locked="false">queue</parameter>
        </parameter>

    </transportReceiver>

xml传输发送程序

<parameter name="ibmMQQueueConnectionFactory" locked="false">
    <parameter name="java.naming.factory.initial" locked="false">com.sun.jndi.fscontext.RefFSContextFactory</parameter>
    <parameter name="java.naming.provider.url" locked="false">file:/E:/work/MQ-JNDI-Directory</parameter>
    <parameter name="transport.jms.ConnectionFactoryJNDIName" locked="false">ConnectionFactoryTest</parameter>
    <parameter name="transport.jms.ConnectionFactoryType" locked="false">queue</parameter>
</parameter>

因此,从活动MQ到Websphere MQ相关Id的映射是有问题的。

但这就是我现在得到的错误--看起来org.apache.axis2.transport.jms.jmsUtils类试图设置JMS_DESTINATION头,而Websphere MQ不允许这样做?

我通过编写一个简单的java客户机验证了这一点,并尝试设置标头JMS_DESTINATION,从Websphere MQ得到了相同的错误。

[2013-03-11 09:33:20,378] DEBUG - JMSMessageReceiver Received new JMS message for service :TestService
Destination    : queue://TESTJMS.IN
Message ID     : ID:dolguldur-50398-1362951749472-3:2:1:1:24
Correlation ID : NONE
ReplyTo        : null
Redelivery ?   : false
Priority       : 0
Expiration     : 0
Timestamp      : 1362958400374
Message Type   :
Persistent ?   : false
[2013-03-11 09:33:20,380] TRACE - JMSMessageReceiver
Message : Enter some text here for the message body...
[2013-03-11 09:33:20,381]  INFO - LogMediator To: , WSAction: urn:mediate, SOAPAction: urn:mediate, MessageID: ID:dolguldur-50398-1362951749472-3:2:1:1:24, Direction: request, Envelope: <?xml version=
'1.0' encoding='utf-8'?><soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"><soapenv:Body><axis2ns5:text xmlns:axis2ns5="http://ws.apache.org/commons/ns/payload">Enter some tex
t here for the message body...</axis2ns5:text></soapenv:Body></soapenv:Envelope>
[2013-03-11 09:33:20,388] DEBUG - JMSConnectionFactory Creating a new JMS Session from JMS CF : ibmMQQueueConnectionFactory
[2013-03-11 09:33:20,392] DEBUG - JMSConnectionFactory Creating a new JMS MessageProducer from JMS CF : ibmMQQueueConnectionFactory
[2013-03-11 09:33:20,393] ERROR - JMSSender Error creating a JMS message from the message context
com.ibm.msg.client.jms.DetailedMessageFormatException: JMSCC0050: The property name 'JMS_DESTINATION' is reserved and cannot be set.
The supplied property name begins with the JMS prefix, but is not one of the supported, settable properties.
Check the property name and correct errors.
        at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
        at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:39)
        at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:27)
        at java.lang.reflect.Constructor.newInstance(Constructor.java:513)
        at com.ibm.msg.client.commonservices.j2se.NLSServices.createException(NLSServices.java:319)
        at com.ibm.msg.client.commonservices.nls.NLSServices.createException(NLSServices.java:233)
        at com.ibm.msg.client.jms.internal.JmsErrorUtils.createException(JmsErrorUtils.java:109)
        at com.ibm.msg.client.jms.internal.JmsMessageImpl.checkSettablePropertyName(JmsMessageImpl.java:2125)
        at com.ibm.msg.client.jms.internal.JmsMessageImpl.setStringProperty(JmsMessageImpl.java:1560)
        at com.ibm.jms.JMSMessage.setStringProperty(JMSMessage.java:1496)
        at org.apache.axis2.transport.jms.JMSUtils.setTransportHeaders(JMSUtils.java:278)
        at org.apache.axis2.transport.jms.JMSSender.createJMSMessage(JMSSender.java:441)
        at org.apache.axis2.transport.jms.JMSSender.sendOverJMS(JMSSender.java:172)
        at org.apache.axis2.transport.jms.JMSSender.sendMessage(JMSSender.java:154)
        at org.apache.axis2.transport.base.AbstractTransportSender.invoke(AbstractTransportSender.java:112)
        at org.apache.axis2.engine.AxisEngine$TransportNonBlockingInvocationWorker.run(AxisEngine.java:626)
        at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886)
        at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908)
        at java.lang.Thread.run(Thread.java:662)
[2013-03-11 09:33:20,399] ERROR - AsyncCallback Error creating a JMS message from the message context
org.apache.axis2.AxisFault: Error creating a JMS message from the message context
        at org.apache.axis2.transport.base.AbstractTransportSender.handleException(AbstractTransportSender.java:226)
        at org.apache.axis2.transport.jms.JMSSender.sendOverJMS(JMSSender.java:174)
        at org.apache.axis2.transport.jms.JMSSender.sendMessage(JMSSender.java:154)
        at org.apache.axis2.transport.base.AbstractTransportSender.invoke(AbstractTransportSender.java:112)
        at org.apache.axis2.engine.AxisEngine$TransportNonBlockingInvocationWorker.run(AxisEngine.java:626)
        at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886)
        at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908)
        at java.lang.Thread.run(Thread.java:662)
Caused by: com.ibm.msg.client.jms.DetailedMessageFormatException: JMSCC0050: The property name 'JMS_DESTINATION' is reserved and cannot be set.
The supplied property name begins with the JMS prefix, but is not one of the supported, settable properties.
Check the property name and correct errors.
        at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
        at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:39)
        at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:27)
        at java.lang.reflect.Constructor.newInstance(Constructor.java:513)
        at com.ibm.msg.client.commonservices.j2se.NLSServices.createException(NLSServices.java:319)
        at com.ibm.msg.client.commonservices.nls.NLSServices.createException(NLSServices.java:233)
        at com.ibm.msg.client.jms.internal.JmsErrorUtils.createException(JmsErrorUtils.java:109)
        at com.ibm.msg.client.jms.internal.JmsMessageImpl.checkSettablePropertyName(JmsMessageImpl.java:2125)
        at com.ibm.msg.client.jms.internal.JmsMessageImpl.setStringProperty(JmsMessageImpl.java:1560)
        at com.ibm.jms.JMSMessage.setStringProperty(JMSMessage.java:1496)
        at org.apache.axis2.transport.jms.JMSUtils.setTransportHeaders(JMSUtils.java:278)
        at org.apache.axis2.transport.jms.JMSSender.createJMSMessage(JMSSender.java:441)
        at org.apache.axis2.transport.jms.JMSSender.sendOverJMS(JMSSender.java:172)
        ... 6 more

共有1个答案

许寒
2023-03-14

这是因为WebSphere MQ遵守JMS规范,该规范规定消息ID始终由传输提供者设置。请参阅JMS1.1规范:

3.4.3 JMSMessageID
JMSMessageID标头字段包含一个值,该值唯一标识提供程序发送的每个消息。

发送消息时,将忽略JMSMessageID。当send方法返回时,该字段包含提供程序分配的值。

 类似资料:
  • 问题内容: tl; dr: 有人知道如何在不设置PATH环境变量的情况下,将chromedriver的路径传递给代码中的selenium- webdriver吗? 我正在尝试将selenium-webdriver与chrome一起使用,但宁愿不实际安装chromedriver并操纵路径。我有以下代码: 在路径中未设置chromedriver的情况下,将引发错误: 我不想设置路径,所以我从npm安装

  • 问题内容: 我知道不推荐这样做,但是是否可以将用户密码传递给scp? 作为批处理作业的一部分,我想通过scp复制文件,接收服务器当然需要密码,不,我不能轻易地将其更改为基于密钥的身份验证。 问题答案: 您就可以使用一个工具脚本它预期(有得心应手绑定太像Pexpect的为Python)。

  • 问题内容: 我试图将URI对象传递给我的Intent,以便在另一个活动中使用该URI。 如何传递URI? 现在如何在其他活动中使用此URI? 感谢你们 问题答案: 您可以将uri存储为字符串 然后像这样将字符串转换回uri

  • 问题内容: 在我的ASP.NET MVC应用程序中,我希望用户将值添加到文本框中,然后按Ajax.ActionLink。我想做这样的事情: Ajax.ActionLink(“ Go”,“ Action”,“ Controller”,新的{value = textbox1.value}) 还是我还能如何使此文本框值返回到我的操作?jQuery的? 问题答案: 您可以使用AJAX $ .get方法运行

  • 问题内容: 我需要更新我的时间。该值由正在执行的函数返回。 返回一个整数。 这将返回未防御状态。因此,我需要获取计数并将其传递给 问题答案: 如果您需要在每次调用之后更改重复间隔,则不能使用-使用恒定重复。您需要使用,因此您可以每次更改时间段:

  • 问题内容: 我试图找到定义可以以一般方式使用的组件的正确方法: 当然,可以想象并在父组件和子组件之间进行渲染的逻辑。 对于这个问题,这是一个虚拟的实现: 问题是,每当您用于定义包装器组件时,如何将某些属性传递给其所有子组件? 问题答案: 用新道具克隆Children 您可以使用React.Children遍历子级,然后使用React.cloneElement使用新的道具(浅合并)克隆每个元素,例如