Skip to content

Instantly share code, notes, and snippets.

@rsrini7
Created August 18, 2015 10:15
Show Gist options
  • Select an option

  • Save rsrini7/d59bf8b733925879f5cf to your computer and use it in GitHub Desktop.

Select an option

Save rsrini7/d59bf8b733925879f5cf to your computer and use it in GitHub Desktop.
Properties properties = new Properties();
properties.put(Context.INITIAL_CONTEXT_FACTORY, "org.jboss.naming.remote.client.InitialContextFactory");
properties.put(Context.PROVIDER_URL,"remote://127.0.0.1:4447");
// username
properties.put(Context.SECURITY_PRINCIPAL, "user");
// password
properties.put(Context.SECURITY_CREDENTIALS, "password");
// This is an important property to set if you want to do EJB invocations via the remote-naming project
properties.put("jboss.naming.client.ejb.context", true);
// create a context passing these properties
return new InitialContext(properties);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment