posted 21 years ago
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 ..