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 » error in getting messages from mq

Post new topic  Reply to topic
 error in getting messages from mq « View previous topic :: View next topic » 
Author Message
ajsc
PostPosted: Thu May 27, 2004 5:00 pm    Post subject: error in getting messages from mq Reply with quote

Newbie

Joined: 11 Apr 2004
Posts: 3

I have a simple code that gets a message from a remote mq :

StringBuffer msgText = new StringBuffer();
MQGetMessageOptions gmo = new MQGetMessageOptions();
gmo.options = MQC.MQGMO_NO_SYNCPOINT + MQC.MQGMO_NO_WAIT;
gmo.waitInterval = 0;

MQMessage retrievedMessage = new MQMessage();

try {
retrievedMessage.messageId = mqMessage.messageId;
inBoundQueue.get(retrievedMessage, gmo, MAX_MESSAGE_SIZE);
msgText.append(retrievedMessage.readString(MAX_MESSAGE_SIZE));
} catch (MQException ex) {
System.out.println("Error::::->reason code was 2033");
}
} catch (java.io.IOException ex) {
ex.printStackTrace();
}

if (msgText.length() != 0)
return (msgText.toString());
else
return ("nothing");

}

_____________________

it seems the error occurs at
inBoundQueue.get(retrievedMessage, gmo, MAX_MESSAGE_SIZE);
which throws an IOException error.

The error message is :

[28/05/04 8:40:28:664 CST] 3f4cb5f0 SystemErr R java.io.EOFException
[28/05/04 8:40:28:664 CST] 3f4cb5f0 SystemErr R at com.ibm.mq.MQMessage.readConvertedString(MQMessage.java:1943)
[28/05/04 8:40:28:664 CST] 3f4cb5f0 SystemErr R at com.ibm.mq.MQMessage.readString(MQMessage.java:960)
[28/05/04 8:40:28:664 CST] 3f4cb5f0 SystemErr R at com.pegi.accs.xpedite.MQAccessGet.readMessage(MQAccessGet.java:335)
[28/05/04 8:40:28:664 CST] 3f4cb5f0 SystemErr R at com.pegi.accs.xpedite.MQAccessGet.getMessage(MQAccessGet.java:205)
[28/05/04 8:40:28:664 CST] 3f4cb5f0 SystemErr R at test.ejb.TestBeanBean.testMq(TestBeanBean.java:67)
[28/05/04 8:40:28:664 CST] 3f4cb5f0 SystemErr R at test.ejb.EJSLocalStatelessTestBean_602aae6f.testMq(EJSLocalStatelessTestBean_602aae6f.java:23)
[28/05/04 8:40:28:664 CST] 3f4cb5f0 SystemErr R at java.lang.reflect.Method.invoke(Native Method)
[28/05/04 8:40:28:664 CST] 3f4cb5f0 SystemErr R at com.ibm.etools.utc.model.ReflectionMethodModel.invoke(ReflectionMethodModel.java:6
[28/05/04 8:40:28:664 CST] 3f4cb5f0 SystemErr R at com.ibm.etools.utc.servlet.InvokeServlet.invoke(InvokeServlet.java:110)
[28/05/04 8:40:28:664 CST] 3f4cb5f0 SystemErr R at com.ibm.etools.utc.servlet.InvokeServlet.doPost(InvokeServlet.java:352)
[28/05/04 8:40:28:664 CST] 3f4cb5f0 SystemErr R at javax.servlet.http.HttpServlet.service(HttpServlet.java:760)
[28/05/04 8:40:28:680 CST] 3f4cb5f0 SystemErr R at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
[28/05/04 8:40:28:711 CST] 3f4cb5f0 SystemErr R at com.ibm.ws.webcontainer.servlet.StrictServletInstance.doService(StrictServletInstance.java:110)
[28/05/04 8:40:28:711 CST] 3f4cb5f0 SystemErr R at com.ibm.ws.webcontainer.servlet.StrictLifecycleServlet._service(StrictLifecycleServlet.java:174)
[28/05/04 8:40:28:711 CST] 3f4cb5f0 SystemErr R at com.ibm.ws.webcontainer.servlet.IdleServletState.service(StrictLifecycleServlet.java:313)
[28/05/04 8:40:28:711 CST] 3f4cb5f0 SystemErr R at com.ibm.ws.webcontainer.servlet.StrictLifecycleServlet.service(StrictLifecycleServlet.java:116)
[28/05/04 8:40:28:711 CST] 3f4cb5f0 SystemErr R at com.ibm.ws.webcontainer.servlet.ServletInstance.service(ServletInstance.java:283)
[28/05/04 8:40:28:711 CST] 3f4cb5f0 SystemErr R at com.ibm.ws.webcontainer.servlet.ValidServletReferenceState.dispatch(ValidServletReferenceState.java:42)
[28/05/04 8:40:28:711 CST] 3f4cb5f0 SystemErr R at com.ibm.ws.webcontainer.servlet.ServletInstanceReference.dispatch(ServletInstanceReference.java:40)
[28/05/04 8:40:28:711 CST] 3f4cb5f0 SystemErr R at com.ibm.ws.webcontainer.webapp.WebAppRequestDispatcher.handleWebAppDispatch(WebAppRequestDispatcher.java:948)
[28/05/04 8:40:28:711 CST] 3f4cb5f0 SystemErr R at com.ibm.ws.webcontainer.webapp.WebAppRequestDispatcher.dispatch(WebAppRequestDispatcher.java:530)
[28/05/04 8:40:28:711 CST] 3f4cb5f0 SystemErr R at com.ibm.ws.webcontainer.webapp.WebAppRequestDispatcher.forward(WebAppRequestDispatcher.java:176)
[28/05/04 8:40:28:711 CST] 3f4cb5f0 SystemErr R at com.ibm.ws.webcontainer.srt.WebAppInvoker.doForward(WebAppInvoker.java:79)
[28/05/04 8:40:28:711 CST] 3f4cb5f0 SystemErr R at com.ibm.ws.webcontainer.srt.WebAppInvoker.handleInvocationHook(WebAppInvoker.java:201)
[28/05/04 8:40:28:711 CST] 3f4cb5f0 SystemErr R at com.ibm.ws.webcontainer.cache.invocation.CachedInvocation.handleInvocation(CachedInvocation.java:71)
[28/05/04 8:40:28:711 CST] 3f4cb5f0 SystemErr R at com.ibm.ws.webcontainer.srp.ServletRequestProcessor.dispatchByURI(ServletRequestProcessor.java:182)
[28/05/04 8:40:28:711 CST] 3f4cb5f0 SystemErr R at com.ibm.ws.webcontainer.oselistener.OSEListenerDispatcher.service(OSEListener.java:334)
[28/05/04 8:40:28:711 CST] 3f4cb5f0 SystemErr R at com.ibm.ws.webcontainer.http.HttpConnection.handleRequest(HttpConnection.java:56)
[28/05/04 8:40:28:711 CST] 3f4cb5f0 SystemErr R at com.ibm.ws.http.HttpConnection.readAndHandleRequest(HttpConnection.java:610)
[28/05/04 8:40:28:711 CST] 3f4cb5f0 SystemErr R at com.ibm.ws.http.HttpConnection.run(HttpConnection.java:435)
[28/05/04 8:40:28:711 CST] 3f4cb5f0 SystemErr R at com.ibm.ws.util.ThreadPool$Worker.run(ThreadPool.java:593)

_____________________

please help....

Back to top
View user's profile Send private message
RogerLacroix
PostPosted: Thu May 27, 2004 8:37 pm    Post subject: Reply with quote

Jedi Knight

Joined: 15 May 2001
Posts: 3264
Location: London, ON Canada

Hi,

Yes, that seems right. I don't know what you have MAX_MESSAGE_SIZE set to but obvious the ACTUAL message size is smaller than MAX_MESSAGE_SIZE.

Why don't you change the code to:
Code:
StringBuffer msgText = new StringBuffer();
MQGetMessageOptions gmo = new MQGetMessageOptions();
gmo.options = MQC.MQGMO_NO_SYNCPOINT + MQC.MQGMO_NO_WAIT;
gmo.waitInterval = 0;

MQMessage retrievedMessage = new MQMessage();

try {
   retrievedMessage.messageId = mqMessage.messageId;
   inBoundQueue.get(retrievedMessage, gmo);
   int msgLength = retrievedMessage.getMessageLength();

   msgText.append(retrievedMessage.readString(msgLength));
}
catch (MQException ex) {
   System.out.println("Error::::->reason code was 2033");
}
catch (java.io.IOException ex) {
   ex.printStackTrace();
}

if (msgText.length() != 0)
   return (msgText.toString());
else
   return ("nothing");

Regards,
Roger Lacroix
_________________
Capitalware: Transforming tomorrow into today.
Connected to MQ!
Twitter
Back to top
View user's profile Send private message Visit poster's website
ajsc
PostPosted: Thu May 27, 2004 9:27 pm    Post subject: Reply with quote

Newbie

Joined: 11 Apr 2004
Posts: 3

Thanks Roger Lacroix =) it worked! =) thank you so much.
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 » error in getting messages from mq
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.