Win a copy of Fixing your Scrum this week in the Agile 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 Pie Elite all forums
this forum made possible by our volunteer staff, including ...
  • Campbell Ritchie
  • Ron McLeod
  • Paul Clapham
  • Rob Spoor
  • Liutauras Vilda
  • Jeanne Boyarsky
  • Junilu Lacar
  • Tim Cooke
Saloon Keepers:
  • Tim Holloway
  • Piet Souris
  • Stephan van Hulst
  • Tim Moores
  • Carey Brown
  • Frits Walraven
  • Himai Minh

Unable to look up JMS topic located on remote server

Posts: 26
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I can use java class to look up the Topic on my local box server, and publish/subscribe messages. However, it failed when I tried to look up the Topic located on remote server within the same network. It seems it still trys to look up Topic on my local server, it's so strange. Could anybody help me out? It's something related to Namespace, how to check that? Thanks!
private void sendMessageToTopic(){
Context ctx = getInitialContext();
TopicConnectionFactory topicConnectionFactory = (TopicConnectionFactory)ctx.lookup("jms/demoTopicConnFactory");
Topic topic = (Topic)ctx.lookup("jms/demoTopic");
TopicConnection topicConnection = topicConnectionFactory.createTopicConnection();
TopicSession topicSession = topicConnection.createTopicSession(false, Session.AUTO_ACKNOWLEDGE);
TopicPublisher topicPublisher = topicSession.createPublisher(topic);
TextMessage msg = topicSession.createTextMessage();
msg.setText("Test message.");
}catch(Exception e){
private Context getInitialContext() throws NamingException {
Hashtable env = new Hashtable();
env.put(Context.INITIAL_CONTEXT_FACTORY, "com.evermind.server.rmi.RMIInitialContextFactory");
env.put(Context.SECURITY_PRINCIPAL, "admin");
env.put(Context.SECURITY_CREDENTIALS, "systemadmin");
env.put(Context.PROVIDER_URL, "ormi://remote host name");
return new InitialContext(env);
Jianhua Ren
this llama doesn't want your drama, he just wants this tiny ad for his mama
the value of filler advertising in 2021
    Bookmark Topic Watch Topic
  • New Topic