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 » Get NameNotFoundException when trying to do context lookup

Post new topic  Reply to topic
 Get NameNotFoundException when trying to do context lookup « View previous topic :: View next topic » 
Author Message
sijtom0703
PostPosted: Fri Dec 30, 2011 10:52 am    Post subject: Get NameNotFoundException when trying to do context lookup Reply with quote

Voyager

Joined: 28 May 2011
Posts: 84
Location: USA

Hi,

I am new to JMS coding and JNDI. I tried to do a Context lookup in my simple JMS code and it is throwing error saying below:
Quote:

javax.naming.NameNotFoundException: Object MQQueueConnectionFactory not found on queue manager SOURCE.QM


The below is the code I am Running

Code:
Hashtable props = new Hashtable();
     props.put(javax.naming.Context.INITIAL_CONTEXT_FACTORY,"com.ibm.mq.jms.context.WMQInitialContextFactory");
     props.put(javax.naming.Context.PROVIDER_URL,"SOURCE.QM");
 
      Context qmContext = new javax.naming.InitialContext(props);
     
     MQQueueConnectionFactory cf = (MQQueueConnectionFactory) qmContext.lookup("MQQueueConnectionFactory");


How can I setup MQQueueConnectionFactory in Queue Manager. I had setup externally using MQ Explorer JMS Administered Objects.


[/quote]
Back to top
View user's profile Send private message
fjb_saper
PostPosted: Fri Dec 30, 2011 1:59 pm    Post subject: Re: Get NameNotFoundException when trying to do context look Reply with quote

Grand High Poobah

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

sijtom0703 wrote:
Hi,

I am new to JMS coding and JNDI. I tried to do a Context lookup in my simple JMS code and it is throwing error saying below:
Quote:

javax.naming.NameNotFoundException: Object MQQueueConnectionFactory not found on queue manager SOURCE.QM


The below is the code I am Running

Code:
Hashtable props = new Hashtable();
     props.put(javax.naming.Context.INITIAL_CONTEXT_FACTORY,"com.ibm.mq.jms.context.WMQInitialContextFactory");
     props.put(javax.naming.Context.PROVIDER_URL,"SOURCE.QM");
 
      Context qmContext = new javax.naming.InitialContext(props);
     
     MQQueueConnectionFactory cf = (MQQueueConnectionFactory) qmContext.lookup("MQQueueConnectionFactory");


How can I setup MQQueueConnectionFactory in Queue Manager. I had setup externally using MQ Explorer JMS Administered Objects.


[/quote]

OK so here is a piece of advice. IBM likes to use the initial context factory type you described above... Unless you are getting your context from WAS, do not use it. It is not suitable for a full blown testing or J2EE environment.
It is only suitable for IBM demonstrations.

Instead look into the file based JNDI and setup the file context (.bindings file)

Have fun
_________________
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 » Get NameNotFoundException when trying to do context lookup
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.