象WEBLOGIC一们,JBOSS也有自己的JNDI了.
Context context = new InitialContext(); YOURHome home = (YOURHome) context.lookup(
"HOME的JNDI名字");直接写就可以用了.如果是找别的JVM的可以这样写.
properties = new Properties();
properties.put(Context.INITIAL_CONTEXT_FACTORY,
"org.jnp.interfaces.NamingContextFactory");
properties.put(Context.PROVIDER_URL, "tangb:8080");
Context context = new InitialContext(properties);
Context context = new InitialContext(); YOURHome home = (YOURHome) context.lookup(
"HOME的JNDI名字");直接写就可以用了.如果是找别的JVM的可以这样写.
properties = new Properties();
properties.put(Context.INITIAL_CONTEXT_FACTORY,
"org.jnp.interfaces.NamingContextFactory");
properties.put(Context.PROVIDER_URL, "tangb:8080");
Context context = new InitialContext(properties);
Properties env = new Properties();
env.put(Context.INITIAL_CONTEXT_FACTORY,"org.jnp.interfaces.NamingContextFactory");
env.put(Context.PROVIDER_URL, "jnp://localhost:1099");
return new InitialContext(env);
}
可以通过上面的方法使用JNDI命名服务
怎么配置?关于通过jndi调用类,jboss做服务器(yangFrame)200
分可以在这个贴子里面给
说不能初初始化
org.jnp.interfaces.NamingContextFactory