Ray da Costa

Arquivo de Abril de 2008

Context para WebService

Terça, 8 de Abril de 2008

Definir parametros
Alternativa 1
Properties props = new Properties();
props.setProperty(”java.naming.provider.url”, “jnp://localhost:1099″);
props.setProperty(”java.naming.factory.url.pkgs”, “org.jboss.naming”);
props.setProperty(”java.naming.factory.initial”,”org.jnp.interfaces.NamingContextFactory”);
InitialContext ctx = new InitialContext( props );

Alternativa 2
Hashtable map = new Hashtable();
String myServer = urlServidor+”:1099″;
map.put(Context.PROVIDER_URL,myServer);
map.put(Context.INITIAL_CONTEXT_FACTORY,”org.jnp.interfaces.NamingContextFactory”);
map.put(”java.naming.rmi.security.manager”,”yes”);
map.put(Context.URL_PKG_PREFIXES,”org.jboss.naming:org.jnp.interfaces”);
Context context = new InitialContext(map);

import javax.naming.*;
public void createNomes() throws NamingException {
Context context = new InitialContext();
context.bind(”/config/applicationName”, “MyAplicacao”);
}
public String […]