ASG
IBM
Zystems
Cressida
Icon
Netflexity
 
  MQSeries.net
Search  Search       Tech Exchange      Education      Certifications      Library      Info Center      SupportPacs      LinkedIn  Search  Search                                                                   FAQ  FAQ   Usergroups  Usergroups
 
Register  ::  Log in Log in to check your private messages
 
RSS Feed - WebSphere MQ Support RSS Feed - Message Broker Support

MQSeries.net Forum Index » IBM MQ Java / JMS » java.io.EOFException thrown by MQMessage.readmessage

Post new topic  Reply to topic
 java.io.EOFException thrown by MQMessage.readmessage « View previous topic :: View next topic » 
Author Message
mjain_mq
PostPosted: Wed Jul 17, 2013 5:54 am    Post subject: java.io.EOFException thrown by MQMessage.readmessage Reply with quote

Newbie

Joined: 14 Jul 2013
Posts: 6

Hi
I am getting below error while tryting to read a particular message, while the code works fine for other.
java.io.EOFException
at com.ibm.mq.MQMessage.readConvertedString(MQMessage.java:828)
at com.ibm.mq.MQMessage.readString(MQMessage.java:785)

I have already verified that the message is a valid XML and contains no invalid chatracters. I am still trying to establish this failure scenario but any suggestion will come as gr8 help.
Thanks

Code:

MQGetMessageOptions getOptions = new MQGetMessageOptions();
getOptions.options = MQC.MQOO_INPUT_AS_Q_DEF | MQC.MQOO_FAIL_IF_QUIESCING | MQC.MQGMO_SYNCPOINT;
int openInQOptions = MQC.MQOO_INPUT_AS_Q_DEF | MQC.MQOO_FAIL_IF_QUIESCING;
inQueue = xaQMgr.getQueueManager().accessQueue(inputQueue, openInQOptions, null, null, null);
inQueue.get(message, getOptions);
String msg = message.readString(message.getMessageLength());
Back to top
View user's profile Send private message
fjb_saper
PostPosted: Wed Jul 17, 2013 7:56 pm    Post subject: Reply with quote

Grand High Poobah

Joined: 18 Nov 2003
Posts: 20756
Location: LI,NY

Looks to me like maybe your options are not set right.

Think about MQC.MQGMO vs MQC.MQPMO vs MQC.MQOO

Have fun
_________________
MQ & Broker admin
Back to top
View user's profile Send private message Send e-mail
rekarm01
PostPosted: Thu Jul 18, 2013 12:34 am    Post subject: Re: java.io.EOFException thrown by MQMessage.readmessage Reply with quote

Grand Master

Joined: 25 Jun 2008
Posts: 1415

mjain_mq wrote:
Code:
String msg = message.readString(message.getMessageLength());

The argument for readString() specifies the number of characters to read from the message, but getMessageLength() returns the number of bytes in the message.

For character sets that use more than one byte per character, readString() would try to read too many characters. readStringOfByteLength() might work out better.
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic  Reply to topic Page 1 of 1

MQSeries.net Forum Index » IBM MQ Java / JMS » java.io.EOFException thrown by MQMessage.readmessage
Jump to:  



You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
Protected by Anti-Spam ACP
 
 


Theme by Dustin Baccetti
Powered by phpBB © 2001, 2002 phpBB Group

Copyright © MQSeries.net. All rights reserved.