JNDI

JNDI is a standard Java API that is bundled with JDK1.3 and higher. JNDI provides a common interface to a variety of existing naming services: DNS, LDAP, Active Directory, RMI registry, COS registry, NIS, and file systems.

http://docs.jboss.org/jbossas/jboss4guide/r1/html/ch3.chapter.html

http://stackoverflow.com/questions/13643127/how-does-the-ejb-client-locate-the-ejb-server-without-url

Sample

Properties:

package test;

import java.security.Security;
import java.util.Properties;
import javax.naming.Context;
import javax.naming.InitialContext;
                    
public class Client
{
    public static void main(String args[]) throws Exception
    {
        Properties env = new Properties();
        env.put(Context.INITIAL_CONTEXT_FACTORY, "org.jnp.interfaces.NamingContextFactory");
        env.put(Context.URL_PKG_PREFIXES, "org.jboss.naming:org.jnp.interfaces");
        env.put(Context.PROVIDER_URL, "jnp://myserver.example.com:1099");
        InitialContext context = new InitialContext(env);
        WSTest test = (WSTest) context.lookup("WSTest/remote");
    }
}

Java/JNDI (last edited 2014-06-10 21:24:29 by 95)