Win a copy of Five Lines of Code this week in the OO, Patterns, UML and Refactoring forum!
  • 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 all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Bear Bibeault
  • Ron McLeod
  • Jeanne Boyarsky
  • Paul Clapham
Sheriffs:
  • Tim Cooke
  • Liutauras Vilda
  • Junilu Lacar
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • fred rosenberger
  • salvin francis
Bartenders:
  • Piet Souris
  • Frits Walraven
  • Carey Brown

Unable to get JNDI lookup for JMS Topic Connection Factory

 
Greenhorn
Posts: 15
  • Mark post as helpful
  • send pies
  • 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 ..
 
I do some of my very best work in water. Like this tiny ad:
Building a Better World in your Backyard by Paul Wheaton and Shawn Klassen-Koop
https://coderanch.com/wiki/718759/books/Building-World-Backyard-Paul-Wheaton
    Bookmark Topic Watch Topic
  • New Topic