• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Unable to get JNDI lookup for JMS Topic Connection Factory

 
Greenhorn
Posts: 15
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I have created JMS Topic Connection Factory and Topic in Websphere 5.0.1 using Websphere JMS provider option.
I am writing a standalone client which will first initalcontext and then do JNDI lookup and send messages to the JMS topic.But I am not able to get TopicConnection Factory lookup.
My code is like this :
try {
Hashtable hash = new Hashtable();
hash.put(Context.INITIAL_CONTEXT_FACTORY,"com.ibm.websphere.naming.WsnInitialContextFactory");
hash.put(Context.PROVIDER_URL,"iiop://hostname:2809");
jndiContext = new InitialContext(hash);
System.out.println("Got Initial Context : "+ jndiContext);
} catch (NamingException e) {
e.printStackTrace();
System.exit(1);
}
try {
System.out.println("Before Lookup Topic Factory");
topicConnectionFactory = (TopicConnectionFactory)jndiContext.lookup("TestTopicConnectionFactoryJNDI");
System.out.println("After Lookup Topic Factory");
topic = (Topic) jndiContext.lookup(topicName);
System.out.println("After Lookup TopicName ");
} catch (NamingException e) {
e.printStackTrace();
System.exit(1);
}
But when I do lookup with the JNDI name of my Topic Connection Factory ,Its giving me this error :
Got Initial Context : javax.naming.InitialContext@48bf9972
Before Lookup Topic Factory
javax.naming.NameNotFoundException: TestTopicConnectionFactoryJNDI
at com.ibm.ws.naming.jndicos.CNContextImpl.doLookup(CNContextImpl.java:1
504)
at com.ibm.ws.naming.jndicos.CNContextImpl.doLookup(CNContextImpl.java:1
458)
at com.ibm.ws.naming.jndicos.CNContextImpl.lookup(CNContextImpl.java:116
8)
at com.ibm.ws.naming.util.WsnInitCtx.lookup(WsnInitCtx.java:132)
at javax.naming.InitialContext.lookup(InitialContext.java:359)
at TopicPublisher.main(TopicPublisher.java:75)

Any idea , what wrong I am doing ..
 
reply
    Bookmark Topic Watch Topic
  • New Topic