Win a copy of Spring Boot in Practice this week in the Spring forum!

ubergeekcd

Greenhorn
+ Follow
since Sep 07, 2003
Cows and Likes
Cows
Total received
0
In last 30 days
0
Total given
0
Likes
Total received
0
Received in last 30 days
0
Total given
0
Given in last 30 days
0
Forums and Threads
Scavenger Hunt
expand Ranch Hand Scavenger Hunt
expand Greenhorn Scavenger Hunt

Recent posts by ubergeekcd

Hello All,

I have this nagging UTFDataFormatException cropping up everytime i call
com.ibm.mq.MQMessage.readString(msgLen)...

I have set the encoding to UTF-8, on the In and out Q's but i still get the ex.
In Psudocode this is what i do.
Open() and Connect() to MQ >>> Init MQMessage , Init MQGetMessageOptions, Call MQMsg.get(), call MQMsg.readString().

Now the thing is MQMsg extends DataInput / Data Output, that means my call to readString(), is followed by a readUTF(), and tat is where it bombs.

If anyone knows the solution .....Relpy
17 years ago
Hey, I tink you need to set the MQGetMessageOptions before doing the get.

Error code 2033 means the Queue is empty.

Try this
MQGetMessageOptions gmo = new MQGetMessageOptions();
gmo.options= MQC.MQGMO_NO_SYNCPOINT; //Set no sync point
gmo.options= MQC.MQGMO_CONVERT; //Handles ASCII/EBCDIC
gmo.options= MQC.MQGMO_WAIT;//Wait until message arrives
gmo.waitInterval= 30000;

this will allow you to wait for the queue.

Also you might want to put in a while(i<5) ie. loop for 5 times
and slap the readString inbetwn that...

Hope this helps....
17 years ago