[jboss-user] [JBoss Messaging] - Re: where do i need to specify the JNP port which is used fo

davidrh do-not-reply at jboss.com
Thu Nov 23 17:10:02 EST 2006


Here is the code that we use to connect to a remote JBoss Messaging server:


  | Hashtable properties1 = new Hashtable();
  | properties1.put(Context.INITIAL_CONTEXT_FACTORY,
  |         "org.jnp.interfaces.NamingContextFactory");
  | properties1.put(Context.URL_PKG_PREFIXES,
  |         "org.jboss.naming:org.jnp.interfaces");
  | properties1.put(Context.PROVIDER_URL, "jnp://remoteserver:1099");
  | properties1.put(Context.SECURITY_PRINCIPAL, "admin");
  | properties1.put(Context.SECURITY_CREDENTIALS, "admin");
  | 
  | ConnectionFactory connectionFactory1 = null;
  | 
  | try {
  |   Context context1 = new InitialContext(properties1);
  |   connectionFactory1 = (ConnectionFactory) context1
  |       .lookup("ConnectionFactory");
  | } catch (NamingException ne) {
  |   throw new RuntimeException(ne);
  | }
  | 

You should replace remoteserver in the above example with your server name or IP address.

View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=3988285#3988285

Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=3988285



More information about the jboss-user mailing list