当前位置: 技术问答>java相关
我在JB7中测试EJB时出错,为什么?
来源: 互联网 发布时间:2015-11-11
本文导语: javax.ejb.EJBException: 未找到EJB对象:Unable to resolve PrjCodEtyBMPEJBRemoteHome. Resolved: '' Unresolved:'PrjCodEtyBMPEJBRemoteHome' 为何我的EJB对象找不着 我在setSessionContext中也是正确的 会不会是我的BMP对象有错 public void setSession...
javax.ejb.EJBException: 未找到EJB对象:Unable to resolve PrjCodEtyBMPEJBRemoteHome. Resolved: '' Unresolved:'PrjCodEtyBMPEJBRemoteHome'
为何我的EJB对象找不着
我在setSessionContext中也是正确的
会不会是我的BMP对象有错
public void setSessionContext(SessionContext sessionContext) {
this.sessionContext = sessionContext;
try{
Context ctx = new InitialContext();
//look up jndi name and cast to Home interface
Object ref = ctx.lookup("PrjSortEtyCMPEJBRemote");
prjSortEtyCMPEJBRemoteHome = (PrjSortEtyCMPEJBRemoteHome)PortableRemoteObject.narrow(ref, PrjSortEtyCMPEJBRemoteHome.class);
ref = ctx.lookup("PrjCodEtyBMPEJBRemoteHome");
prjCodEtyBMPEJBRemoteHome = (PrjCodEtyBMPEJBRemoteHome)PortableRemoteObject.narrow(ref, PrjCodEtyBMPEJBRemoteHome.class);
}
catch(Exception e){
throw new EJBException("未找到EJB对象:"+e.getMessage());
}
}
为何我的EJB对象找不着
我在setSessionContext中也是正确的
会不会是我的BMP对象有错
public void setSessionContext(SessionContext sessionContext) {
this.sessionContext = sessionContext;
try{
Context ctx = new InitialContext();
//look up jndi name and cast to Home interface
Object ref = ctx.lookup("PrjSortEtyCMPEJBRemote");
prjSortEtyCMPEJBRemoteHome = (PrjSortEtyCMPEJBRemoteHome)PortableRemoteObject.narrow(ref, PrjSortEtyCMPEJBRemoteHome.class);
ref = ctx.lookup("PrjCodEtyBMPEJBRemoteHome");
prjCodEtyBMPEJBRemoteHome = (PrjCodEtyBMPEJBRemoteHome)PortableRemoteObject.narrow(ref, PrjCodEtyBMPEJBRemoteHome.class);
}
catch(Exception e){
throw new EJBException("未找到EJB对象:"+e.getMessage());
}
}
|
ref = ctx.lookup("PrjCodEtyBMPEJBRemoteHome");
应该去掉Home吧!
应该去掉Home吧!