• Post Reply Bookmark Topic Watch Topic
  • New Topic

JMS JNDI destination lookup  RSS feed

 
vinitha simon
Ranch Hand
Posts: 64
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I have issues with my JNDI lookup . I got my context.xml outside of my webapplication . I have pasted the code below . But it was throwing NameNotFoundException .

javax.naming.NameNotFoundException: jms/Test at com.sun.jndi.fscontext.RefFSContext.getObjectFromBindings(RefFSContext.java:400

Hashtable hashtableEnvironment = new Hashtable();
hashtableEnvironment.put(Context.INITIAL_CONTEXT_FACTORY, "com.sun.jndi.fscontext.RefFSContextFactory");
hashtableEnvironment.put(Context.PROVIDER_URL, "file:///C:/sample");
Context context = new InitialContext(hashtableEnvironment);
NamingEnumeration namingenumeration = context.listBindings("");
while (namingenumeration.hasMore()) {
Binding binding = (Binding)namingenumeration.next();
System.out.println(
binding.getName() + " is bound to " +
binding.getObject()
);
}

Destination dest = (Destination) context.lookup("jms/test");


any help is appreciated.
 
Stu Quinn
Ranch Hand
Posts: 35
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Which application server are you using? Can you browse your JNDI viewer and confirm the name?
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!