【发布时间】:2019-04-22 16:01:14
【问题描述】:
我想知道 EJB 规范是否允许通过查找的有状态会话 bean 访问有状态会话 bean。
我问的原因是,Jboss EAP 7.0 没有问题,但是当我尝试访问 bean 时,Websphere 会抛出 NullPointerException。
例如:
@Stateful
public class SampleServiceRoot implements SampleServiceRootRemote {
@EJB
protected SampleServiceChildLocal servicechild;
@Override
public SampleServiceChildLocal getServiceChild(){
return servicechild;
}
}
@Stateful
public class SampleServiceChild implements SampleServiceChildLocal,SampleServiceChildRemote{
@Override
public void anyMethod(){
//DO Anything
}
}
当我对 SampleServiceRootRemote 进行远程查找并调用“getServiceChild()”并尝试对其调用“anyMethod()”时,它在 JBoss EAP 7.0 上工作,但在 Websphere 上我得到了 NullPointerException。
所以我想知道这是 Websphere 中的错误还是 EJB 规范禁止它,而我只是幸运地使用了 JBoss EAP 7.0?
【问题讨论】:
标签: java ejb websphere jboss-eap-7 stateful