Author |
Message
|
marcmouries |
Posted: Mon Feb 05, 2007 10:45 am Post subject: MQJE001: An MQException occurred: Completion Code 2, Reason |
|
|
Newbie
Joined: 05 Feb 2007 Posts: 4
|
Hi,
I am using the following piece of code to connect to MQ. It works fine on my machine where the client and server are local. However on another machine environment where the server is remote, this code throws theh exception javax.jms.JMSException: MQJMS2005: failed to create MQQueueManager for '10.239.255.249:QPX.SERVER'
I checked the name of the Qs, the name of the Q managers. Is there any settings to change in a remote environment?
Thanks.
Marc
public void connect() throws MQException, JMSException {
// Create a Queue Connection Factory & set its properties
MQQueueConnectionFactory factory = new MQQueueConnectionFactory();
factory.setTransportType(JMSC.MQJMS_TP_CLIENT_MQ_TCPIP);
factory.setQueueManager(queueMgr);
factory.setHostName(hostName);
factory.setChannel(channel);
// factory.setPort(1414);
// factory.setCCSID(819);
// Create a Connection
qConnection = factory.createQueueConnection();
qConnection.start();
// Create a queue manager
MQQueueManager qMgr = new MQQueueManager(queueMgr);
// Create a Queue
int openOptions = MQC.MQOO_INPUT_AS_Q_DEF | MQC.MQOO_OUTPUT;
queue = qMgr.accessQueue(queueName, openOptions);
} |
|
Back to top |
|
 |
jefflowrey |
Posted: Mon Feb 05, 2007 10:51 am Post subject: |
|
|
Grand Poobah
Joined: 16 Oct 2002 Posts: 19981
|
You'll need to report the linked exception, which will have the MQ reason code.
The JMS error is very non-specific. _________________ I am *not* the model of the modern major general. |
|
Back to top |
|
 |
marcmouries |
Posted: Mon Feb 05, 2007 10:55 am Post subject: |
|
|
Newbie
Joined: 05 Feb 2007 Posts: 4
|
Linked Exception is : com.ibm.mq.MQException: MQJE001: An MQExceptio
n occurred: Completion Code 2, Reason 2058
[java] MQJE036: Queue manager rejected connection attempt |
|
Back to top |
|
 |
fjb_saper |
Posted: Mon Feb 05, 2007 2:02 pm Post subject: |
|
|
 Grand High Poobah
Joined: 18 Nov 2003 Posts: 20756 Location: LI,NY
|
Not surprisingly.
You are mixing base java and JMS.
Please do not mix those 2 in your code.
JMS => qcf, connection, destinations, send & receive, browser, listener(see onMessage()).
None of these objects refer to MQQueueManager!
Enjoy  _________________ MQ & Broker admin |
|
Back to top |
|
 |
marcmouries |
Posted: Mon Feb 05, 2007 4:34 pm Post subject: |
|
|
Newbie
Joined: 05 Feb 2007 Posts: 4
|
Thanks for your answer. However it is really as obvious for me as it might be for you. Could you elaborate your answer a little bit? |
|
Back to top |
|
 |
EddieA |
Posted: Mon Feb 05, 2007 4:38 pm Post subject: |
|
|
 Jedi
Joined: 28 Jun 2001 Posts: 2453 Location: Los Angeles
|
The Using Java manual has 2 distinct sections. One is "Programming with WebSphere MQ base Java", the other is "Programming with WebSphere MQ JMS". You should use one, or the other. Not a combination.
Cheers, _________________ Eddie Atherton
IBM Certified Solution Developer - WebSphere Message Broker V6.1
IBM Certified Solution Developer - WebSphere Message Broker V7.0 |
|
Back to top |
|
 |
marcmouries |
Posted: Tue Feb 06, 2007 7:47 am Post subject: |
|
|
Newbie
Joined: 05 Feb 2007 Posts: 4
|
The reason of why I mixed 2 api to connect to MQ is:
1. When using only JMS API, the Message ID will be modified by MQ Series, but we must use a specific code as message ID
2. When only use MQ API, MQ API has no listener API for register to queue, I have to get message from queue round robin, but the command console will display”MQJE001: Completion Code 2, Reason 2033” when the queue is empty, I don’t find the way to prevent it. |
|
Back to top |
|
 |
jefflowrey |
Posted: Tue Feb 06, 2007 9:00 am Post subject: |
|
|
Grand Poobah
Joined: 16 Oct 2002 Posts: 19981
|
|
Back to top |
|
 |
michael.shapira |
Posted: Tue Apr 03, 2007 11:46 pm Post subject: |
|
|
Novice
Joined: 03 Apr 2007 Posts: 14
|
I have the same problem, can you please tell me what is the solution. I trying to find the documentation about programming MQ you remind earlier, but all I found were some courses.
I am using the same pease of code |
|
Back to top |
|
 |
Vitor |
Posted: Tue Apr 03, 2007 11:59 pm Post subject: |
|
|
 Grand High Poobah
Joined: 11 Nov 2005 Posts: 26093 Location: Texas, USA
|
If you start from:
http://publib.boulder.ibm.com/infocenter/wmqv6/v6r0/index.jsp
You'll find the Using Java manual referenced in the post, describing the 2 types of Java methodology.
I repeat the comments about using specific message ids. This is such a bad idea, with many posts discussing the many problems it causes. _________________ Honesty is the best policy.
Insanity is the best defence. |
|
Back to top |
|
 |
rehab_desoki |
Posted: Wed Apr 18, 2007 11:53 pm Post subject: I tried that and it's work with me |
|
|
Novice
Joined: 25 Oct 2005 Posts: 18
|
I tried this code to connect to remote MQ queue manager hosted on sun solaries operating system from my client on windows operating system and it's work will with me and no need to set channel
qcf = new MQQueueConnectionFactory();
qcf.setQueueManager("MYQM");
qcf.setHostName("10.0.100.109");//write IP not host name
qcf.setPort(1414);
//Transport type CLIENT not BINDING
qcf.setTransportType(JMSC.MQJMS_TP_CLIENT_MQ_TCPIP);
queue = new MQQueue();
queue.setBaseQueueName("C003.INPUT.QUEUE");
qConnection = qcf.createQueueConnection("myuser","");
qSession =qConnection.createQueueSession(false,Session.AUTO_ACKNOWLEDGE);
qReceiver = qSession.createReceiver(queue); |
|
Back to top |
|
 |
BenR |
Posted: Thu Apr 19, 2007 2:36 am Post subject: |
|
|
Acolyte
Joined: 31 Jan 2006 Posts: 60 Location: Hursley, UK
|
The 'correct' JMS way to do this
Quote: |
queue = new MQQueue();
queue.setBaseQueueName("C003.INPUT.QUEUE");
|
is
Quote: |
javax.jms.Queue queue = qSession.createQueue("C003.INPUT.QUEUE");
|
Saves you having to have a provider-specific Queue implementation in your code. |
|
Back to top |
|
 |
fjb_saper |
Posted: Thu Apr 19, 2007 12:34 pm Post subject: Re: I tried that and it's work with me |
|
|
 Grand High Poobah
Joined: 18 Nov 2003 Posts: 20756 Location: LI,NY
|
rehab_desoki wrote: |
I tried this code to connect to remote MQ queue manager hosted on sun solaries operating system from my client on windows operating system and it's work will with me and no need to set channel
qcf = new MQQueueConnectionFactory();
qcf.setQueueManager("MYQM");
qcf.setHostName("10.0.100.109");//write IP not host name
qcf.setPort(1414);
//Transport type CLIENT not BINDING
qcf.setTransportType(JMSC.MQJMS_TP_CLIENT_MQ_TCPIP);
queue = new MQQueue();
queue.setBaseQueueName("C003.INPUT.QUEUE");
qConnection = qcf.createQueueConnection("myuser","");
qSession =qConnection.createQueueSession(false,Session.AUTO_ACKNOWLEDGE);
qReceiver = qSession.createReceiver(queue); |
Where is your channel definition ? _________________ MQ & Broker admin |
|
Back to top |
|
 |
|