MoinMoin Logo
  • Comments
  • Immutable Page
  • Menu
    • Navigation
    • RecentChanges
    • FindPage
    • Local Site Map
    • Help
    • HelpContents
    • HelpOnMoinWikiSyntax
    • Display
    • Attachments
    • Info
    • Raw Text
    • Print View
    • Edit
    • Load
    • Save
  • Login

Navigation

  • Start
  • Sitemap
Revision 1 as of 2014-06-10 21:24:29
  • Java
  • JNDI

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:

  • java.naming.factory.initial=org.jnp.interfaces.NamingContextFactory

  • java.naming.provider.url=jnp://localhost:1099
  • java.naming.factory.url.pkgs=org.jboss.naming:org.jnp.interfaces

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");
    }
}
  • MoinMoin Powered
  • Python Powered
  • GPL licensed
  • Valid HTML 4.01