初学EJB,请问我的EJB怎么访问出错?
写了一个极其简单的EJB,就是返回一个HELLO的字符串,可是在客户端访问的时候却出错。我的代码如下:
try
{
Properties env = System.getProperties();
env.put(
javax.naming.Context.INITIAL_CONTEXT_FACTORY,
"com.ibm.websphere.naming.WsnInitialContextFactory");
env.put(Context.PROVIDER_URL, "iiop://localhost");
InitialContext ic = new InitialContext(env);
SayHelloHome home =
(SayHelloHome) javax.rmi.PortableRemoteObject.narrow(
ic.lookup("SayHelloHome"),
SayHello.class);
SayHello bean = home.create();
String ret = bean.sayHello();
System.out.println(ret);
}
catch (Exception ex)
{
System.out.println("error!!!");
ex.printStackTrace();
}
可是运行的时候却出错:
java.lang.NoClassDefFoundError: com/ibm/ejs/jts/jts/CurrentFactory
这是为什么呢?我已经包含了所有的WAS的包,而且在IBM通用测试环境下(WEB环境)已经测试通过,证明该EJB部署的没有问题。请问我该怎么做呢?谢谢