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 » JMS over MQ 6, able to read messages, but cant send

Post new topic  Reply to topic
 JMS over MQ 6, able to read messages, but cant send « View previous topic :: View next topic » 
Author Message
prashanth.cn
PostPosted: Thu Sep 25, 2008 6:10 am    Post subject: JMS over MQ 6, able to read messages, but cant send Reply with quote

Newbie

Joined: 23 Sep 2008
Posts: 3

Quote:
---------Continuation of the above question------------

I have MQ setup in my local machine. Have created the MQ Manager and queue using MQ Explorer. Confgired the Websphere MQ in Wesbpehere app server.

I have written two jsps, one for sending message and the other for readng. I am able to read messages whateever I manually put using MQ Explorer. I am also trying to send messages to the same queue. But I am getting some errors, not sure what is the problem. Do I need to create any channels for the queue in MQ explorer. if so, what type?? I tried creating various channels, but nothing worked. I even referred tutorials before trying out my own.

Have attached the programs for reading and sending the messages

Reading the messages:
javax.naming.Context context = new javax.naming.InitialContext();
javax.jms.ConnectionFactory cf = (javax.jms.ConnectionFactory) context.lookup("jms/MyConFactory");

javax.jms.Destination destination = (javax.jms.Destination) context.lookup("jms/MyQueue");

javax.jms.Connection connection = cf.createConnection();
javax.jms.Session jmssession = connection.createSession(false,1);
javax.jms.MessageConsumer consumer = jmssession.createConsumer(destination);
connection.start();

javax.jms.TextMessage message = (javax.jms.TextMessage) consumer.receiveNoWait();
System.out.println("Message ------>"+message.getText());

message.clearBody();
jmssession.close();
connection.close();

Program for sending message
javax.jms.ConnectionFactory cf = (javax.jms.ConnectionFactory) context.lookup("jms/MyConFactory");
javax.jms.Destination destination = (javax.jms.Destination) context.lookup("jms/MyQueue");
javax.jms.Connection connection = cf.createConnection();
connection.start();
javax.jms.Session jmssession = connection.createSession(false,1);
javax.jms.MessageProducer producer = jmssession.createProducer(destination);
javax.jms.TextMessage message = jmssession.createTextMessage("Test Message from Prashnth Machine");
producer.send(message);
producer.close();
jmssession.close();
connection.stop();

--------------Error thrown ----------------
[9/25/08 19:07:27:721 IST] 00000043 WebApp E SRVE0026E: [Servlet Error]-[/MQTest.jsp]: javax.jms.JMSException: MQJMS2007: failed to send message to MQ queue
at com.ibm.mq.jms.services.ConfigEnvironment.newException(ConfigEnvironment.java:553)
at com.ibm.mq.jms.MQMessageProducer.sendInternal(MQMessageProducer.java:1598)
at com.ibm.mq.jms.MQMessageProducer.send(MQMessageProducer.java:1022)
at com.ibm.mq.jms.MQMessageProducer.send(MQMessageProducer.java:1056)
at com.ibm.ejs.jms.JMSMessageProducerHandle.send(JMSMessageProducerHandle.java:1168)
at com.ibm._jsp._MQTest._jspService(_MQTest.java:94)
at com.ibm.ws.jsp.runtime.HttpJspBase.service(HttpJspBase.java:8
at javax.servlet.http.HttpServlet.service(HttpServlet.java:856)
at com.ibm.ws.webcontainer.servlet.ServletWrapper.service(ServletWrapper.java:1282)
at com.ibm.ws.webcontainer.servlet.ServletWrapper.handleRequest(ServletWrapper.java:673)
at com.ibm.wsspi.webcontainer.servlet.GenericServletWrapper.handleRequest(GenericServletWrapper.java:117)
at com.ibm.ws.jsp.webcontainerext.JSPExtensionServletWrapper.handleRequest(JSPExtensionServletWrapper.java:178)
at com.ibm.ws.jsp.webcontainerext.JSPExtensionProcessor.handleRequest(JSPExtensionProcessor.java:241)
at com.ibm.ws.webcontainer.webapp.WebApp.handleRequest(WebApp.java:2905)
at com.ibm.ws.webcontainer.webapp.WebGroup.handleRequest(WebGroup.java:220)
at com.ibm.ws.webcontainer.VirtualHost.handleRequest(VirtualHost.java:204)
at com.ibm.ws.webcontainer.WebContainer.handleRequest(WebContainer.java:1829)
at com.ibm.ws.webcontainer.channel.WCChannelLink.ready(WCChannelLink.java:84)
at com.ibm.ws.http.channel.inbound.impl.HttpInboundLink.handleDiscrimination(HttpInboundLink.java:469)
at com.ibm.ws.http.channel.inbound.impl.HttpInboundLink.handleNewInformation(HttpInboundLink.java:408)
at com.ibm.ws.http.channel.inbound.impl.HttpInboundLink.ready(HttpInboundLink.java:286)
at com.ibm.ws.tcp.channel.impl.NewConnectionInitialReadCallback.sendToDiscriminaters(NewConnectionInitialReadCallback.java:201)
at com.ibm.ws.tcp.channel.impl.NewConnectionInitialReadCallback.complete(NewConnectionInitialReadCallback.java:103)
at com.ibm.ws.tcp.channel.impl.WorkQueueManager.requestComplete(WorkQueueManager.java:566)
at com.ibm.ws.tcp.channel.impl.WorkQueueManager.attemptIO(WorkQueueManager.java:619)
at com.ibm.ws.tcp.channel.impl.WorkQueueManager.workerRun(WorkQueueManager.java:952)
at com.ibm.ws.tcp.channel.impl.WorkQueueManager$Worker.run(WorkQueueManager.java:1039)
at com.ibm.ws.util.ThreadPool$Worker.run(ThreadPool.java:1455)
---- Begin backtrace for Nested Throwables
com.ibm.mq.MQException: MQJE001: Completion Code 2, Reason 2009
at com.ibm.mq.MQQueue.putMsg2(MQQueue.java:1501)
at com.ibm.mq.jms.MQMessageProducer.sendInternal(MQMessageProducer.java:1578)
at com.ibm.mq.jms.MQMessageProducer.send(MQMessageProducer.java:1022)
at com.ibm.mq.jms.MQMessageProducer.send(MQMessageProducer.java:1056)
at com.ibm.ejs.jms.JMSMessageProducerHandle.send(JMSMessageProducerHandle.java:1168)
at com.ibm._jsp._MQTest._jspService(_MQTest.java:94)
at com.ibm.ws.jsp.runtime.HttpJspBase.service(HttpJspBase.java:8
at javax.servlet.http.HttpServlet.service(HttpServlet.java:856)
at com.ibm.ws.webcontainer.servlet.ServletWrapper.service(ServletWrapper.java:1282)
at com.ibm.ws.webcontainer.servlet.ServletWrapper.handleRequest(ServletWrapper.java:673)
at com.ibm.wsspi.webcontainer.servlet.GenericServletWrapper.handleRequest(GenericServletWrapper.java:117)
at com.ibm.ws.jsp.webcontainerext.JSPExtensionServletWrapper.handleRequest(JSPExtensionServletWrapper.java:178)
at com.ibm.ws.jsp.webcontainerext.JSPExtensionProcessor.handleRequest(JSPExtensionProcessor.java:241)
at com.ibm.ws.webcontainer.webapp.WebApp.handleRequest(WebApp.java:2905)
at com.ibm.ws.webcontainer.webapp.WebGroup.handleRequest(WebGroup.java:220)
at com.ibm.ws.webcontainer.VirtualHost.handleRequest(VirtualHost.java:204)
at com.ibm.ws.webcontainer.WebContainer.handleRequest(WebContainer.java:1829)
at com.ibm.ws.webcontainer.channel.WCChannelLink.ready(WCChannelLink.java:84)
at com.ibm.ws.http.channel.inbound.impl.HttpInboundLink.handleDiscrimination(HttpInboundLink.java:469)
at com.ibm.ws.http.channel.inbound.impl.HttpInboundLink.handleNewInformation(HttpInboundLink.java:408)
at com.ibm.ws.http.channel.inbound.impl.HttpInboundLink.ready(HttpInboundLink.java:286)
at com.ibm.ws.tcp.channel.impl.NewConnectionInitialReadCallback.sendToDiscriminaters(NewConnectionInitialReadCallback.java:201)
at com.ibm.ws.tcp.channel.impl.NewConnectionInitialReadCallback.complete(NewConnectionInitialReadCallback.java:103)
at com.ibm.ws.tcp.channel.impl.WorkQueueManager.requestComplete(WorkQueueManager.java:566)
at com.ibm.ws.tcp.channel.impl.WorkQueueManager.attemptIO(WorkQueueManager.java:619)
at com.ibm.ws.tcp.channel.impl.WorkQueueManager.workerRun(WorkQueueManager.java:952)
at com.ibm.ws.tcp.channel.impl.WorkQueueManager$Worker.run(WorkQueueManager.java:1039)
at com.ibm.ws.util.ThreadPool$Worker.run(ThreadPool.java:1455)
Back to top
View user's profile Send private message
atheek
PostPosted: Thu Sep 25, 2008 6:25 am    Post subject: Reply with quote

Partisan

Joined: 01 Jun 2006
Posts: 327
Location: Sydney

search this forum for mqjms2007 reason code 2009...you will get lot of hints
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 » JMS over MQ 6, able to read messages, but cant send
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.