无法在WebLogic,JMS,Java中为JMS_IBM_MQMD_MsgId设置属性值 [英] Cannot set the property value for JMS_IBM_MQMD_MsgId in weblogic, JMS, java

查看:305
本文介绍了无法在WebLogic,JMS,Java中为JMS_IBM_MQMD_MsgId设置属性值的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想向JMS队列发送消息,并且想设置一个对象属性:

I want to send a message to a JMS Queue, and I want to set an object property:

tMessage.setObjectProperty("JMS_IBM_MQMD_MsgId", bytes); //bytes is a byte array value

但是此行出现异常:

tMessage.setObjectProperty("JMS_IBM_MQMD_MsgId", toByteArray((phone+"IBM").toCharArray()));

为什么不能将字节数组设置为此属性?我看到了一些示例,每个人都设置了字节数组,但是却出现异常:

Why cannot I set byte array to this property? I saw some example, and everyone sets bytearray, but I am getting exception:

weblogic.jms.common.MessageFormatException: [JMSClientExceptions:055123]Invalid property value, [B@48647dd0

为什么?谢谢!

推荐答案

对于

setObjectProperty方法接受Boolean,Byte, 短,整数,长,浮点,双精度和字符串.尝试使用任何 其他类必须抛出JMSException.

The setObjectProperty method accepts values of class Boolean, Byte, Short, Integer, Long, Float, Double, and String. An attempt to use any other class must throw a JMSException.

因此它不接受ByteArray. setObjectProperty接受Object,因此不会出现编译错误.

So it does not accept ByteArray. setObjectProperty accepts Object so you don't get compile error.

这篇关于无法在WebLogic,JMS,Java中为JMS_IBM_MQMD_MsgId设置属性值的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆