我部署了一个简单的ejb,
用客户端调用的时候
import javax.naming.InitialContext;
import javax.naming.Context;
import javax.rmi.PortableRemoteObject;
import QueryInterface.*;
import QueryBean.*;
import java.util.*;
public class Test
{
public static void main(String[] args)
{
try
{
Properties env=new Properties();
env.setProperty("java.naming.factory.initial","org.jnp.interfaces.NamingContextFactory");
env.setProperty("java.naming.provider.url","localhost:1099");
InitialContext jndiContext = new InitialContext(env);
Object ref = jndiContext.lookup("QueryBean");
System.out.println("Got reference");
TestQueryHome home = (TestQueryHome)
PortableRemoteObject.narrow(ref, TestQueryHome.class);
QueryBean qb = home.create();
}
catch(Exception e)
{
System.out.println(e.toString());
}
}
}
执行的时候提示错误:
javax.naming.NoinitialContextException:Cannot instantiate class:org.jnp.interfaces.NamingContextFactory[Root exception is java.lang.ClassNotFoundException:org.jnp.interfaces.NamingContextFactory]
是我的初始化工厂地址错误吗?
麻烦老大了!