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 IndexIBM MQ Java / JMSMQJE001: An MQException occurred: Completion Code 2, Reason

Post new topicReply to topic
MQJE001: An MQException occurred: Completion Code 2, Reason View previous topic :: View next topic
Author Message
marcmouries
PostPosted: Mon Feb 05, 2007 10:45 am Post subject: MQJE001: An MQException occurred: Completion Code 2, Reason Reply with quote

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
View user's profile Send private message
jefflowrey
PostPosted: Mon Feb 05, 2007 10:51 am Post subject: Reply with quote

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
View user's profile Send private message
marcmouries
PostPosted: Mon Feb 05, 2007 10:55 am Post subject: Reply with quote

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
View user's profile Send private message
fjb_saper
PostPosted: Mon Feb 05, 2007 2:02 pm Post subject: Reply with quote

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
View user's profile Send private message Send e-mail
marcmouries
PostPosted: Mon Feb 05, 2007 4:34 pm Post subject: Reply with quote

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
View user's profile Send private message
EddieA
PostPosted: Mon Feb 05, 2007 4:38 pm Post subject: Reply with quote

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
View user's profile Send private message
marcmouries
PostPosted: Tue Feb 06, 2007 7:47 am Post subject: Reply with quote

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
View user's profile Send private message
jefflowrey
PostPosted: Tue Feb 06, 2007 9:00 am Post subject: Reply with quote

Grand Poobah

Joined: 16 Oct 2002
Posts: 19981

Someone has designed a bad system for you, that requires a specific message id.

You can prevent the command console from displaying the 2033 message by setting the log to null.

http://publib.boulder.ibm.com/infocenter/wmqv6/v6r0/topic/com.ibm.mq.csqzaw.doc/csqzaw1462.htm
_________________
I am *not* the model of the modern major general.
Back to top
View user's profile Send private message
michael.shapira
PostPosted: Tue Apr 03, 2007 11:46 pm Post subject: Reply with quote

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
View user's profile Send private message
Vitor
PostPosted: Tue Apr 03, 2007 11:59 pm Post subject: Reply with quote

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
View user's profile Send private message
rehab_desoki
PostPosted: Wed Apr 18, 2007 11:53 pm Post subject: I tried that and it's work with me Reply with quote

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
View user's profile Send private message MSN Messenger
BenR
PostPosted: Thu Apr 19, 2007 2:36 am Post subject: Reply with quote

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
View user's profile Send private message Visit poster's website
fjb_saper
PostPosted: Thu Apr 19, 2007 12:34 pm Post subject: Re: I tried that and it's work with me Reply with quote

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
View user's profile Send private message Send e-mail
Display posts from previous:
Post new topicReply to topic Page 1 of 1

MQSeries.net Forum IndexIBM MQ Java / JMSMQJE001: An MQException occurred: Completion Code 2, Reason
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.