• 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 ...
  • Campbell Ritchie
  • Ron McLeod
  • Rob Spoor
  • Tim Cooke
  • Junilu Lacar
  • Henry Wong
  • Liutauras Vilda
  • Jeanne Boyarsky
Saloon Keepers:
  • Jesse Silverman
  • Tim Holloway
  • Stephan van Hulst
  • Tim Moores
  • Carey Brown
  • Al Hobbs
  • Mikalai Zaikin
  • Piet Souris

JMS and client application

Posts: 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi, here is my code ..

public class JMSProducer
public static void main(String[] args)
Context ctx = null;
TopicConnectionFactory cf = null;
TopicConnection con = null;
Topictopic= null;
TopicSessionses = null;

Properties properties = new Properties();
properties.put(Context.INITIAL_CONTEXT_FACTORY, "org.jnp.interfaces.NamingContextFactory");
properties.put(Context.PROVIDER_URL, "localhost:1099");

ctx = new InitialContext(properties);
} catch (NamingException e) {
System.out.println("Could not create JNDI API context : "+ e.toString());

try {
cf = (TopicConnectionFactory) ctx.lookup("jms/TopicConnectionFactory");
topic= (Topic) ctx.lookup("jms/Topic");
} catch (NamingException e1) {
System.out.println("JNDI API lookup failed : "+ e1.toString());

try {
con = cf.createTopicConnection();
ses = con.createTopicSession(false, Session.AUTO_ACKNOWLEDGE);
TopicPublisher pub = ses.createPublisher(topic);
TextMessage msg = ses.createTextMessage();

} catch (JMSException e2) {

In these client application, i lookup for the jndi names of Conenction factory and Destination(jms/TopicConnectionFactory, jms/topic). My question is where to configure these jndi name. In case of servlet/jsp, we configure jndi in web.xml and server specific xml files. But in case of client application, where u have to specify the resouurces...

urgent pls,
Don't get me started about those stupid light bulbs.
    Bookmark Topic Watch Topic
  • New Topic