简体   繁体   中英

IBM Character Set Header Causing Exceptions

We have a Spring Integration flow which consumes messages off a Websphere MQ Manager queue. These messages are put through a simple process and afterwards are put into another queue (in the same MQ Manager).

When we try to write the messages to the final destination queue, we are getting the following error:

Caused by: javax.jms.JMSException: MQJMS1006: invalid value for 'JMS_IBM_Character_Set': 'IBM850'.
        at com.ibm.msg.client.wmq.v6.jms.internal.ConfigEnvironment.newException(ConfigEnvironment.java:431) ~[com.ibm.mqjms-7.0.1.3.jar:7.0.1.3 - k701-103-100812]
        at com.ibm.msg.client.wmq.v6.jms.internal.MQMessageProducer.sendInternal(MQMessageProducer.java:1153) ~[com.ibm.mqjms-7.0.1.3.jar:7.0.1.3 - k701-103-100812]
        at com.ibm.msg.client.wmq.v6.jms.internal.MQMessageProducer.send(MQMessageProducer.java:779) ~[com.ibm.mqjms-7.0.1.3.jar:7.0.1.3 - k701-103-100812]
        at com.ibm.msg.client.wmq.v6.jms.internal.MQMessageProducer.send(MQMessageProducer.java:2718) ~[com.ibm.mqjms-7.0.1.3.jar:7.0.1.3 - k701-103-100812]
        at com.ibm.msg.client.jms.internal.JmsMessageProducerImpl.sendMessage(JmsMessageProducerImpl.java:907) ~[com.ibm.mqjms-7.0.1.3.jar:7.0.1.3 - k701-103-100812]
        at com.ibm.msg.client.jms.internal.JmsMessageProducerImpl.send_(JmsMessageProducerImpl.java:762) ~[com.ibm.mqjms-7.0.1.3.jar:7.0.1.3 - k701-103-100812]
        at com.ibm.msg.client.jms.internal.JmsMessageProducerImpl.send(JmsMessageProducerImpl.java:393) ~[com.ibm.mqjms-7.0.1.3.jar:7.0.1.3 - k701-103-100812]
        at com.ibm.mq.jms.MQMessageProducer.send(MQMessageProducer.java:333) ~[com.ibm.mqjms-7.0.1.3.jar:7.0.1.3 - k701-103-100812]
        at org.springframework.jms.connection.CachedMessageProducer.send(CachedMessageProducer.java:181) ~[spring-jms-4.2.1.RELEASE.jar:4.2.1.RELEASE]
        at org.springframework.jms.core.JmsTemplate.doSend(JmsTemplate.java:636) ~[spring-jms-4.2.1.RELEASE.jar:4.2.1.RELEASE]
        at org.springframework.jms.core.JmsTemplate.doSend(JmsTemplate.java:607) ~[spring-jms-4.2.1.RELEASE.jar:4.2.1.RELEASE]
        at org.springframework.jms.core.JmsTemplate$4.doInJms(JmsTemplate.java:584) ~[spring-jms-4.2.1.RELEASE.jar:4.2.1.RELEASE]
        at org.springframework.jms.core.JmsTemplate.execute(JmsTemplate.java:494) ~[spring-jms-4.2.1.RELEASE.jar:4.2.1.RELEASE]
        at org.springframework.jms.core.JmsTemplate.send(JmsTemplate.java:580) ~[spring-jms-4.2.1.RELEASE.jar:4.2.1.RELEASE]
        at org.springframework.jms.core.JmsTemplate.convertAndSend(JmsTemplate.java:706) ~[spring-jms-4.2.1.RELEASE.jar:4.2.1.RELEASE]
        at org.springframework.integration.jms.JmsSendingMessageHandler.send(JmsSendingMessageHandler.java:145) ~[spring-integration-jms-4.2.0.RELEASE.jar:?]
        at org.springframework.integration.jms.JmsSendingMessageHandler.handleMessageInternal(JmsSendingMessageHandler.java:115) ~[spring-integration-jms-4.2.0.RELEASE.jar:?]
        at org.springframework.integration.handler.AbstractMessageHandler.handleMessage(AbstractMessageHandler.java:127) ~[spring-integration-core-4.2.0.RELEASE.jar:?]

The messages we pick up from the initial queue have the following IBM-Specific headers:

JMS_IBM_Character_Set=IBM850,
JMS_IBM_MQMD_CodedCharSetId=850,
JMS_IBM_Encoding=17,
JMS_IBM_PutApplType=11,
JMS_IBM_Format=        ,
JMSXDeliveryCount=1,
JMS_IBM_PutTime=12534150,
JMS_IBM_MsgType=8

and they are still there when we try and write the processed message into the final Websphere MQ Queue.

The project is using the following IBM MQ dependency jars:

compile 'com.ibm:com.ibm.mq:7.0.1.3'
compile 'com.ibm:com.ibm.mqjms:7.0.1.3'
compile 'com.ibm:com.ibm.mq.jmqi:7.0.1.3'
compile 'com.ibm:com.ibm.mq.headers:7.0.1.3'

What is the correct way of resolving this exception? Should we:

  1. Strip any JMS_IBM_XXX headers from the message before writing to the final Websphere MQ Queue?
  2. Use different version jars?
  3. Do something else entirely?

We don't seem to experience this issue in any other flows that pick up messages from a Websphere MQ queue and finally writes them to another Websphere MQ queue.

Quoting WebSphere MQ 7.5 - MS_IBM_Character_Set :

Prior to WebSphere® MQ V7.5, applications using WebSphere MQ messaging provider migration mode could set the JMS_IBM_Character_Set property of a message to a numerical Coded Character Set Identifier.

When the message was sent, the Coded Character Set Identifier stored in the JMS_IBM_Character_Set property was mapped to the MQMD field CodedCharacterSetID.

When using the WebSphere MQ V7.5 classes for JMS, a JMSException containing the message:

 MQJMS1006: invalid value for 'JMS_IBM_Character_Set': '<number>' 

is thrown if an application tries to send a message that has the JMS_IBM_Character_Set property set to a numerical Coded Character Set Identifier.

The JMS_IBM_Character_Set property must be set to the Java character set string that maps to the Coded Character Set Identifier that the application wants to use. For more information, see Mapping JMS fields onto WebSphere MQ fields (outgoing messages)

Since you are using version 7.0.1.3, not 7.5 or later, the value must be a "numerical Coded Character Set Identifier " , meaning it should be 850 (numerical), not IBM850 .

In version 7.5 it should be IBM850 .

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM