我把你的问题简化下然后咱们再来说是否能够实现。访问jndi资源是通过Context的lookup进行查找的。这样是否能够实现远程的一个JNDI的调用就主要集中在context的构造上。我写2种方式。楼主最好还是自己去看下API:Hashtable env = new Hashtable();
env.put(Context.INITIAL_CONTEXT_FACTORY, "javax.naming.spi.InitialContextFactory");
env.put(Context.PROVIDER_URL, "iiop://192.168.XXX.XXX:1050");
Context ctx = new InitialContext(env);
另外一种:Properties contextProp = new Properties();
contextProp.setProperty(Context.INITIAL_CONTEXT_FACTORY, "javax.naming.spi.InitialContextFactory");
contextProp.setProperty(Context.PROVIDER_URL, "iiop://192.168.XXX.XXX:1050"); context= new InitialContext(contextProp); 简单的例子。可能说明不了什么。还是那句话需要楼主自己去看API来实现。
env.put(Context.INITIAL_CONTEXT_FACTORY, "javax.naming.spi.InitialContextFactory");
env.put(Context.PROVIDER_URL, "iiop://192.168.XXX.XXX:1050");
Context ctx = new InitialContext(env);
另外一种:Properties contextProp = new Properties();
contextProp.setProperty(Context.INITIAL_CONTEXT_FACTORY, "javax.naming.spi.InitialContextFactory");
contextProp.setProperty(Context.PROVIDER_URL, "iiop://192.168.XXX.XXX:1050"); context= new InitialContext(contextProp); 简单的例子。可能说明不了什么。还是那句话需要楼主自己去看API来实现。
端口1050?
http://forum.java.sun.com/thread.jspa?threadID=584253&messageID=2995484