我已经配置了一个链接所对应的国外jndi工厂!但是我不知道如何在我自己的应用程序中使用国外jndi!有人能帮我个忙吗?
发布于 2010-01-27 00:29:03
很含糊的问题,所以很含糊的答案...下面是如何获取Context
Context ctx = null;
Hashtable ht = new Hashtable();
ht.put(Context.INITIAL_CONTEXT_FACTORY,
"weblogic.jndi.WLInitialContextFactory");
ht.put(Context.PROVIDER_URL,
"t3://localhost:7001");
try {
ctx = new InitialContext(ht);
// Use the context in your program
}
catch (NamingException e) {
// a failure occurred
} finally {
try {
ctx.close();
} catch (Exception e) {
// a failure occurred
}
}您需要在类路径上使用wl-client.jar。更多详细信息,请访问Programming WebLogic JNDI。
PS:我不会容忍异常,文档示例会这样做:)
https://stackoverflow.com/questions/2018471
复制相似问题