0

I have registered JNDI. When I invoke Conrext.createSubcontext I get the exception:

javax.naming.OperationNotSupportedException
at com.sun.jndi.rmi.registry.RegistryContext.createSubcontext(RegistryContext.java:226)
at com.sun.jndi.toolkit.url.GenericURLContext.createSubcontext(GenericURLContext.java:390)
at javax.naming.InitialContext.createSubcontext(InitialContext.java:464)

Implementation looks like:

 Registry reg = LocateRegistry.createRegistry(1099);

 Properties properties = new Properties();
 properties.put(Context.INITIAL_CONTEXT_FACTORY, "org.jnp.interfaces.NamingContextFactory");
 properties.put(Context.URL_PKG_PREFIXES, "org.jboss.naming:org.jnp.interfaces");
 properties.put(Context.PROVIDER_URL, "localhost:1099");

 InitialContext initialContextcontext = new InitialContext(properties);

 ic.createSubcontext("rmi://localhost/java:jdbc");

Please suggest where I missed.

4

1 回答 1

1

提供程序不支持子上下文。RMI Registry 本身没有:它提供一维命名空间。

可能您为 JNP 使用了错误的提供程序。

于 2013-05-15T22:48:49.420 回答