[jboss-user] [JBoss Messaging] - Re: How to create Connection object without using JNDI?

clebert.suconic@jboss.com do-not-reply at jboss.com
Mon Jul 30 15:44:12 EDT 2007


Ahhh... now I understand your question:


This is something you can easily do in JNDI. You could create a method like this. the returned Context will be bound to the host you pass as a parameter:


  | 
  | 
  |    // the default method
  |    protected Context createContext() throws Exception
  |    {
  |         return createContext("jnp://localhost:1099");
  |    }
  |    protected Context createContext(String host) throws Exception
  |    {
  |       Properties props = new Properties();
  | 
  |       props.put(Context.INITIAL_CONTEXT_FACTORY, "org.jnp.interfaces.NamingContextFactory");
  |       props.put(Context.PROVIDER_URL, host);
  |       props.put(Context.URL_PKG_PREFIXES, "org.jnp.interfaces");
  | 
  |       return new InitialContext(props);
  |    }
  | 

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

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



More information about the jboss-user mailing list