public interface BaseInterface{
Customer createCustomer(Profile profile);
}
public interface InterfaceA extends BaseInterface{
}
public class ServiceProducer {
@EJB(lookup = "java:global/path/ClassA")
@Produces
private InterfaceA interfaceA;
}
@Remote(ClassA.class)
public class ClassA implements InterfaceA{
BaseInterface base;
@Inject
public ClassA(@Named BaseInterface base){
this.base = base;
}
@Override
createCustomer implementation ...
}
模块 2 客户端
public class Api{
@Inject
InterfaceA intA;
@Override
Customer createCustomer(arg){
intA.createCustomer
}
}
嗨,我在运行上述代码时收到以下错误
“ClassA”的无状态EJBLocator,视图是接口InterfaceA,关联性是Local
WFLYEJB0034:组件 WorkflowManager 上方法公共抽象 Customer BaseInterface.createCustomer(Profile) 的 EJB 调用失败:javax.ejb.EJBTransactionRolledbackException:WFLYEE0042:无法构造组件实例
你的界面上面应该有@local