当前位置: 技术问答>java相关
这是什么原因?jbuiler生成的ejb testclient抱错
来源: 互联网 发布时间:2015-11-03
本文导语: "Remote interface reference is null. It must be created by calling one of the Home interface methods first." 我用session bean 调用entity bean 当调用finduser() 方法后出现上述问题,什么原因 finduser代码如下 ,属于session bean ,且配置...
"Remote interface reference is null. It must be created by calling one of the Home interface methods first."
我用session bean 调用entity bean
当调用finduser() 方法后出现上述问题,什么原因
finduser代码如下 ,属于session bean ,且配置了ejb-local-ref 访问entityBean
public boolean FindUser(String username) {
try{
Context ctx = new InitialContext();
this.usershome = (UsersHome)PortableRemoteObject.narrow(ctx.lookup("java:comp/env/ejb/Users"),UsersHome.class);
}catch(Exception e){ }
Collection c1=null;
try{
c1=usershome.findByUserName(username);
System.out.println("finishing calling findByUserName at check session Bean!n");
}catch(Exception e) { return false;}
return true;
}
请说说什么问题
我用session bean 调用entity bean
当调用finduser() 方法后出现上述问题,什么原因
finduser代码如下 ,属于session bean ,且配置了ejb-local-ref 访问entityBean
public boolean FindUser(String username) {
try{
Context ctx = new InitialContext();
this.usershome = (UsersHome)PortableRemoteObject.narrow(ctx.lookup("java:comp/env/ejb/Users"),UsersHome.class);
}catch(Exception e){ }
Collection c1=null;
try{
c1=usershome.findByUserName(username);
System.out.println("finishing calling findByUserName at check session Bean!n");
}catch(Exception e) { return false;}
return true;
}
请说说什么问题
|
home.create()
有吗?
有吗?
|
对不起写错了,应该是
this.usershome = (UsersHome)ctx.lookup("java:comp/env/ejb/Users);
this.usershome = (UsersHome)ctx.lookup("java:comp/env/ejb/Users);
本站(WWW.)旨在分享和传播互联网科技相关的资讯和技术,将尽最大努力为读者提供更好的信息聚合和浏览方式。
本站(WWW.)站内文章除注明原创外,均为转载、整理或搜集自网络。欢迎任何形式的转载,转载请注明出处。
本站(WWW.)站内文章除注明原创外,均为转载、整理或搜集自网络。欢迎任何形式的转载,转载请注明出处。