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 » General Discussion » Getting Exception com.ibm.mq.MQException: MQJE001:

Post new topic  Reply to topic
 Getting Exception com.ibm.mq.MQException: MQJE001: « View previous topic :: View next topic » 
Author Message
umaphani
PostPosted: Fri Jan 18, 2008 7:38 am    Post subject: Getting Exception com.ibm.mq.MQException: MQJE001: Reply with quote

Newbie

Joined: 18 Jan 2008
Posts: 4

hi All

I am new to MQ series , i have got mqseries server installed on my machine. i have connected to it using mqExplorer and created queue Manager and server connection channel and local queue.

then when i run the following code locally ,i am getting following exception
Code:

my Hashtable (properties) contains the following details
MQC.HOST_NAME_PROPERTY=localhost ;
MQC.PORT_PROPERTY =1414;
MQC.CHANNEL_PROPERTY ="testChannel";
MQQueueManager qmgr = null;
MQQueue queue = null;
String msgString = null;
MQMessage message =null;
try
{
 for(int i=0;i<150;i++)
 {
  qmgr = new MQQueueManager("testQueueManager",properties);
  queue = qmgr.AccessQueue("testQueue",openOptions,null,null,null);
  msgString=getDataFromFile();
  message = new MQMessage();
  message.WriteString(msgString);
  queue.put(msg,putMessageOptions);
}

}catch(MQException mq)
{
mq.printStackTrace();
}


i am getting the following exception

com.ibm.mq.MQException: MQJE001: An MQException occurred: Completion Code 2, Reason 2009
MQJE016: MQ queue manager closed channel immediately during connect
Closure reason = 2009
at com.ibm.mq.MQManagedConnectionJ11.<init>(MQManagedConnectionJ11.java:221)
at com.ibm.mq.MQClientManagedConnectionFactoryJ11._createManagedConnection(MQClientManagedConnectionFactoryJ11.java:318)
at com.ibm.mq.MQClientManagedConnectionFactoryJ11.createManagedConnection(MQClientManagedConnectionFactoryJ11.java:338)
at com.ibm.mq.StoredManagedConnection.<init>(StoredManagedConnection.java:84)
at com.ibm.mq.MQSimpleConnectionManager.allocateConnection(MQSimpleConnectionManager.java:168)
at com.ibm.mq.MQQueueManagerFactory.obtainBaseMQQueueManager(MQQueueManagerFactory.java:773)
at com.ibm.mq.MQQueueManagerFactory.procure(MQQueueManagerFactory.java:698)
at com.ibm.mq.MQQueueManagerFactory.constructQueueManager(MQQueueManagerFactory.java:658)
at com.ibm.mq.MQQueueManagerFactory.createQueueManager(MQQueueManagerFactory.java:154)
at com.ibm.mq.MQQueueManager.<init>(MQQueueManager.java:527)

one thing i have observed through my MQExplorer is that 98 messages were sucessfully send to Queue. if i have changed my iteration from 150 to less than 100 , its working fine. one thing i want to know is there any thing like connections or channels count should not be more than 100.

if i add the following code then irrespective of my iteration its working fine.
Code:

finally
{
queue.close();
qmgr.disconnect();
}


i agree that my problem with earlier code is i am not closing my resources.
but I want to know why its breaking with that 98 count. if i did not my finally block. is there any way i can change my settings in mQExplorer and run my code with out adding that finally block so that i can post more than 100 messages.

i hope i would get some reply
Back to top
View user's profile Send private message
jefflowrey
PostPosted: Fri Jan 18, 2008 7:39 am    Post subject: Reply with quote

Grand Poobah

Joined: 16 Oct 2002
Posts: 19981

Install the latest version of MQ Client software on your local machine.
_________________
I am *not* the model of the modern major general.
Back to top
View user's profile Send private message
Vitor
PostPosted: Fri Jan 18, 2008 8:15 am    Post subject: Re: Getting Exception com.ibm.mq.MQException: MQJE001: Reply with quote

Grand High Poobah

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

Ok, be aware Java is not my preferred language so this is a bit theoretical.

umaphani wrote:
one thing i want to know is there any thing like connections or channels count should not be more than 100.


The queue manager has a deliberate limit of the number of connections. There's also the question of available resources; if you don't clear up then sooner or later you'll run out.

umaphani wrote:
is there any way i can change my settings in mQExplorer and run my code with out adding that finally block so that i can post more than 100 messages.


You'd be better off fixing the apparent bug in your program (see my comment up top). For each itteration you create a new queue manager object and hence a new connection - why? You're better off establishing one connection and doing 150 puts. It's more efficent in terms of resources and will run faster.

Check out the "Using Java" manual, and the sample code.
_________________
Honesty is the best policy.
Insanity is the best defence.
Back to top
View user's profile Send private message
jefflowrey
PostPosted: Fri Jan 18, 2008 8:22 am    Post subject: Reply with quote

Grand Poobah

Joined: 16 Oct 2002
Posts: 19981

Oh, I see.

Yes, by default MaxChannels=100 and MaxActiveChannels=MaxChannels.
_________________
I am *not* the model of the modern major general.
Back to top
View user's profile Send private message
umaphani
PostPosted: Fri Jan 18, 2008 8:33 am    Post subject: Reply with quote

Newbie

Joined: 18 Jan 2008
Posts: 4

Actually my requirement is some thing like this.

I am having some DB view which returns some 200 ids, by using each id i will get data from some x table and insert it into staging table and by using my EAI tool i would generate a text file which would be sent to MQQueue.

the above whole process is repeated for each record.

then my whole code would look like this
Code:

my Hashtable (properties) contains the following details
MQC.HOST_NAME_PROPERTY=localhost ;
MQC.PORT_PROPERTY =1414;
MQC.CHANNEL_PROPERTY ="testChannel";
MQQueueManager qmgr = null;
MQQueue queue = null;
String msgString = null;
MQMessage message =null;
try
{

  qmgr = new MQQueueManager("testQueueManager",properties);
  queue = qmgr.AccessQueue("testQueue",openOptions,null,null,null);
  msgString=getDataFromFile();
  message = new MQMessage();
  message.WriteString(msgString);
  queue.put(msg,putMessageOptions);

}catch(MQException mq)
{
mq.printStackTrace();
}

if my view returns 50 ids its working fine, if more than 100 , than i am getting my error. i do agree the problem is due to lack of not closing mq connection.
is my problem with lack of connection closing or channel?
is there any way to find how many max connections does MQQueueManger permit by using MQSC commands.
Back to top
View user's profile Send private message
bower5932
PostPosted: Fri Jan 18, 2008 11:08 am    Post subject: Reply with quote

Jedi Knight

Joined: 27 Aug 2001
Posts: 3023
Location: Dallas, TX, USA

umaphani wrote:
is my problem with lack of connection closing or channel?


These two go hand in hand. For performance, you should move your qmgr and queue statements outside of your loop (and remember to close them after the loop).
Back to top
View user's profile Send private message Send e-mail Visit poster's website AIM Address Yahoo Messenger
Vitor
PostPosted: Fri Jan 18, 2008 12:45 pm    Post subject: Reply with quote

Grand High Poobah

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

umaphani wrote:

is my problem with lack of connection closing or channel?


Yes it is. I think I said that, or something like that.

umaphani wrote:

is there any way to find how many max connections does MQQueueManger permit by using MQSC commands.


Yes - the DISPLAY QMGR command. Think carefully before increasing the value; remember that each connection is another process in the machine that takes resource. Coding the application as you have now will cost you in performance & theoretically run the box out of resource.

And of course, whatever you increased the limit to, sooner or later you'd need one more!
_________________
Honesty is the best policy.
Insanity is the best defence.
Back to top
View user's profile Send private message
jefflowrey
PostPosted: Fri Jan 18, 2008 12:50 pm    Post subject: Reply with quote

Grand Poobah

Joined: 16 Oct 2002
Posts: 19981

Each connection is a separate thread in the MCAs on the server, not a separate process.

An MQ app needs one connection for each MQ call it needs to make simultaneously. This is usually never more than one.

It is never a good idea to create a new connection for each MQ Put or Get.

Ever ever ever.

In this case, it's clear that umaphani needs only one connection, i.e. one call to new MQQueueManager().

In addition, it's pretty clear that umaphani needs only one call to Access Queue.
_________________
I am *not* the model of the modern major general.
Back to top
View user's profile Send private message
Vitor
PostPosted: Sat Jan 19, 2008 6:01 am    Post subject: Reply with quote

Grand High Poobah

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

jefflowrey wrote:
Each connection is a separate thread in the MCAs on the server, not a separate process.


I always get that wrong.....
_________________
Honesty is the best policy.
Insanity is the best defence.
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 » General Discussion » Getting Exception com.ibm.mq.MQException: MQJE001:
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.