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 » MQJMS2007: failed to send message to MQ queue -Help

Post new topic  Reply to topic
 MQJMS2007: failed to send message to MQ queue -Help « View previous topic :: View next topic » 
Author Message
70033
PostPosted: Wed Sep 08, 2010 2:35 pm    Post subject: MQJMS2007: failed to send message to MQ queue -Help Reply with quote

Apprentice

Joined: 22 Dec 2008
Posts: 27

I am using jms to connect to a MQ queue manager on a remote host, following is my code snippet

Hashtable props = getSystemProperties();
InitialContext context = new InitialContext(props);
QueueConnectionFactory cf;

cf = (QueueConnectionFactory) context
.lookup(queueConnectionFactory);

conn = cf.createQueueConnection();
Queue q = (Queue) context.lookup("jms/MyQ");
jmsSession = conn.createQueueSession(false,
Session.AUTO_ACKNOWLEDGE);

TextMessage tm = jmsSession.createTextMessage();
tm.setText("Hi, there!");
QueueSender sender1 = jmsSession.createSender(q);
sender1.send(tm);
sender1.close();
jmsSession.close();
conn.close();


I am using properties like this

properties.put("java.naming.factory.initial", "com.sun.jndi.fscontext.RefFSContextFactory");
properties.put("java.naming.provider.url", "file:/C:/JNDI-Directory");

and i generate the bindings file appropriately from the remote box. When i try to send , i get the javax.jms.JMSException: MQJMS2007: failed to send message to MQ queue exception.

JMSException in publish Message: javax.jms.JMSException: MQJMS2007: failed to send message to MQ queue
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:1589)
at com.ibm.mq.jms.MQMessageProducer.send(MQMessageProducer.java:1012)
at com.ibm.mq.jms.MQMessageProducer.send(MQMessageProducer.java:1046)
MQClientHitter.publishMessage(MQClientHitter.java:69)
at MQClientHitter.main(MQClientHitter.java:110)



Based on some hits that i saw for this i had increased the size of messages,length on the Queue Manager but to no avail. I think that it is having no issues in connecting (I can use the same code from within the apache tomcat and it works). Can someone help me please? Is there any configuration/code changes that i need to do to get this working..

Thx
Back to top
View user's profile Send private message
RogerLacroix
PostPosted: Wed Sep 08, 2010 2:42 pm    Post subject: Re: MQJMS2007: failed to send message to MQ queue -Help Reply with quote

Jedi Knight

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

70033 wrote:
JMSException in publish Message: javax.jms.JMSException: MQJMS2007: failed to send message to MQ queue
javax.jms.JMSException: MQJMS2007: failed to send message to MQ queue

You need to dump out the LinkedException for this error.
Code:
catch (JMSException e)
{
   System.err.println("getLinkedException()=" + e.getLinkedException());
   System.err.println(e.getLocalizedMessage());
   e.printStackTrace();
}


The LinkedException will give you the MQ reason code which will help you determine what is the real issue.

Regards,
Roger Lacroix
Capitalware Inc.
_________________
Capitalware: Transforming tomorrow into today.
Connected to MQ!
Twitter
Back to top
View user's profile Send private message Visit poster's website
70033
PostPosted: Fri Sep 10, 2010 6:55 am    Post subject: Exception with linked exceptions Reply with quote

Apprentice

Joined: 22 Dec 2008
Posts: 27

ame=jms/MyQ
replyto queueName=null
JMSException in publish Message: javax.jms.JMSException: MQJMS2007: failed to send message to MQ queue
getLinkedException()=com.ibm.mq.MQException: MQJE001: Completion Code 2, Reason 2009
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:1589)
at com.ibm.mq.jms.MQMessageProducer.send(MQMessageProducer.java:1012)
at com.ibm.mq.jms.MQMessageProducer.send(MQMessageProducer.java:1046)
Back to top
View user's profile Send private message
Vitor
PostPosted: Fri Sep 10, 2010 7:02 am    Post subject: Re: Exception with linked exceptions Reply with quote

Grand High Poobah

Joined: 11 Nov 2005
Posts: 26093
Location: Texas, USA

70033 wrote:
Completion Code 2, Reason 2009


2009 is a connection broken. If this was working and stopped, then the queue manager is out of connections. If it never worked, your connection information is faulty.

Other explainations of this code are possible; you'll find them discussed in the product documentation and on this forum along with remedial actions.
_________________
Honesty is the best policy.
Insanity is the best defence.
Back to top
View user's profile Send private message
fjb_saper
PostPosted: Fri Sep 10, 2010 7:05 am    Post subject: Reply with quote

Grand High Poobah

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

When you set up your .bindings file for the JNDI lookup did you define the connection factory as being local or remote for the access? (host + channel + port, or just qmgr name)?
_________________
MQ & Broker admin
Back to top
View user's profile Send private message Send e-mail
70033
PostPosted: Fri Sep 10, 2010 7:29 am    Post subject: I am using client since i intend to use it remotely Reply with quote

Apprentice

Joined: 22 Dec 2008
Posts: 27

5724-H72, 5655-L82, 5724-L26 (c) Copyright IBM Corp. 2002,2005. All Rights Reserved.
Starting Websphere MQ classes for Java(tm) Message Service Administration

InitCtx> define xaqcf(MyQCF1) qmgr(TEST) hostname(10.151.39.79) port(1717) transport(CLIENT) channel(svrconn)

InitCtx> define q(jms/MyQ1) queue(REQUEST) qmgr(TEST)

InitCtx> end

Stopping Websphere MQ classes for Java(tm) Message Service Administration
Back to top
View user's profile Send private message
fjb_saper
PostPosted: Fri Sep 10, 2010 9:46 am    Post subject: Reply with quote

Grand High Poobah

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

Do you have a channel defined with name "svrconn" ?
Did you inadvertently put the channel type in the channel field instead of putting the channel name?
Be aware that case matters
_________________
MQ & Broker admin
Back to top
View user's profile Send private message Send e-mail
Display posts from previous:   
Post new topic  Reply to topic Page 1 of 1

MQSeries.net Forum Index » IBM MQ Java / JMS » MQJMS2007: failed to send message to MQ queue -Help
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.