[jboss-user] [Beginners Corner] - Re: Problem with new InitialContext().lookup(

Wolfgang Knauf do-not-reply at jboss.com
Mon Feb 16 09:12:25 EST 2009


you have to initialize your InitialContext with the server connection, so that it can access the remote JNDI:

Properties props = new Properties();
  | props.setProperty(Context.INITIAL_CONTEXT_FACTORY, "org.jnp.interfaces.NamingContextFactory");
  | props.setProperty(Context.URL_PKG_PREFIXES, "org.jboss.naming.client");
  | props.setProperty(Context.PROVIDER_URL, "jnp://localhost:1099");
  | InitialContext initialContext = new InitialContext(props);
  | Object ref = context.lookup("HelloBean/remote");

Hope this helps


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

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

More information about the jboss-user mailing list