javax.naming.NoInitialContextException: Need to specify class name in environment or system property, or as an applet parameter, or in an application resource file: java.naming.factory.initial
我是在利用Context进行lookup("helloWorld")操作的时候产生这个异常,
ejb和客户端在同一台机器的不同dos窗口."helloWorld"这个jndi名称肯定是正确的,
而且大小写也没问题,但是总是查询不到,请问是什么原因?
你在初始化InitalContext的时候没有指定必要的属性
包括
Context.INITIAL_CONTEXT_FACTORY
Context.PROVIDER_URL等等
Hashtable ht = new Hashtable();
ht.put(ctx.PROVIDER_URL, "t3://ip:7001" );
ht.put(ctx.INITIAL_CONTEXT_FACTORY, "weblogic.jndi.WLInitialContextFactory");
ctx = new InitialContext(ht);