• 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

JMS JNDI destination lookup

 
Ranch Hand
Posts: 64
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.
 
Ranch Hand
Posts: 35
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Which application server are you using? Can you browse your JNDI viewer and confirm the name?
 
reply
    Bookmark Topic Watch Topic
  • New Topic