GeeCON Prague 2014*
The moose likes EJB and other Java EE Technologies and the fly likes Unable to look up JMS topic located on remote server Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


JavaRanch » Java Forums » Java » EJB and other Java EE Technologies
Bookmark "Unable to look up JMS topic located on remote server" Watch "Unable to look up JMS topic located on remote server" New topic
Author

Unable to look up JMS topic located on remote server

Jianhua Ren
Greenhorn

Joined: Oct 19, 2003
Posts: 26
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(){
try{
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.");
topicPublisher.publish(msg);
}catch(Exception e){
e.printStackTrace();
}
}
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
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Unable to look up JMS topic located on remote server