1. 使用JNDI需要先到Sun官方网站现在相应的jar
例:
Hashtable env = new Hashtable();
env.put(Context.INITIAL_CONTEXT_FACTORY,
"com.sun.jndi.rmi.registry.RegistryContextFactory"); //需要下载RMI Registry Service Provider, 1.2.1 jar
env.put(Context.INITIAL_CONTEXT_FACTORY, "com.sun.jndi.fscontext.RefFSContextFactory");
//需要下载File System Service Provider, 1.2 Beta 3 jar
下载地址:
或
http://java.sun.com/products/jndi/downloads/index.html#DOWNLOAD12
2.